Hi All, So I'm trying to use this great component for displaying pdf files

Hi All,
So I’m trying to use this great component for displaying pdf files generated from JasperReports. The report is displayed in the layout but downloading throws an exception “Stream Closed”. It could be my code and any work around this is appreciated.

JasperExportManager.exportReportToPdfFile(jasperPrint, reportPath+"\\report.pdf");
InputStream pdf=new FileInputStream(reportPath+"//report.pdf");
StreamResource resource = new StreamResource("abc.pdf", () -> pdfStream);
				pdfViewer=new PdfViewer();
				pdfViewer.setSrc(resource);
				pdfViewer.setSizeFull();
				layout.add(pdfViewer);