How to change title and icon for a jasper reports PDF with Spring Boot 2+?

I'm generating a report with JasperReports in a new tab in PDF format, using Spring Boot 2.0.1, everything is working as expected.

But I want change the title and icon of the pages that reports are generated, because it is getting the default icon of spring, and the title is getting the controller mapping.

Image of what is going on:

A sample!

OBS.: as you know, Spring losts the integration with JasperReports, so in my controller I'm returning a byte[] instead of a modelAndView.

Code:

@PostMapping("/filtro")
public ResponseEntity<byte[]> gerarRelatorio(Principal principal, IncidenciaLista conteudo) throws Exception{

    UsuarioSistema us = (UsuarioSistema) ((Authentication) principal).getPrincipal();

    byte[] relatorio = relatorioService.gerarRelatorioFiltrado(us.getUsuario().getEmpresa().getNome(), conteudo.getNomeProjeto(), conteudo.getLista());

    return ResponseEntity.ok()
            .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PDF_VALUE)
            .body(relatorio);
}

Upvotes: 0

Views: 1126

Answers (1)

Darren Forsythe
Darren Forsythe

Reputation: 11411

Simply add an favicon.ico image to src/main/resources/favicon.ico

The image should meet the following criteria,

name - favicon.ico size - 32x32 or 16x16 pixels Color - 265

Upvotes: 1

Related Questions