I have a pdf file save as a byte array a db table. Now, I want to retrieve

I have a pdf file save as a byte array in a db table. Now, I want to retrieve it from the db and display it. When using the following code:

InputStream is = new ByteArrayInputStream(report.getPdfForm());
StreamResource resource = new StreamResource("blah", () -> is);
				
viewer = new PdfBrowserViewer(resource);
pdfViewer.add(viewer);

The filesystem Save As dialog opens? Am I doing something wrong here?

Thanks

i got same problem, using that i solve, try set resource mimetype

resource.setContentType(“application/pdf”);
resource.setCacheTime(0);