-1

Has anyone managed to display the .jasper report in standalone view? I am using Vaadin v23. Not enough information found for v23. I am preparing an end of degree project and I have only found information for v14 and v10

ISalcedo
  • 11
  • 2
  • Please see [How to ask](https://stackoverflow.com/help/how-to-ask). Questions must be in English. Please add the code you have tried and how it failed (e.g. errors, stacktraces, logs, ...) so we can improve on it. – cfrick Oct 23 '22 at 10:15

1 Answers1

1

Valid for Vaadin V23 + Spring Boot to view a .jasper report.

It's not elegant, but it works for what I need:

try {
    bytes = JasperRunManager.runReportToPdf(getClass().getResourceAsStream(searchpath), null, DataSource);
    byte[] finalBytes = bytes;
    streamResource1 = new StreamResource("?.pdf", () ->new ByteArrayInputStream(finalBytes));
} catch (JRException e) {
    e.printStackTrace();
}
PdfBrowserViewer viewer= new PdfBrowserViewer(streamResource1);
viewer.setHeight("100%");
add(viewer);
cfrick
  • 35,203
  • 6
  • 56
  • 68
ISalcedo
  • 11
  • 2