0
The code shows a method that is called by the browser to generate a PDF. The bytes were generated by Jasper. The code works normally.
@GetMapping("/relatorios/teste")
public ResponseEntity<byte[]> relatorio() throws Exception{
byte[] relatorio = lancamentoService.relatorio();
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PDF_VALUE)
.body(relatorio);
}
OBS1: My problem is when I have the bytes of a docx! I’ve tried to do something similar to PDF, but I haven’t succeeded yet, I tried several code found on the net and nothing.
OBS2: Docx bytes i Gero using Apache POI.
You are using Spring Boot?
– nullptr