zbigniew.nitecki Posted March 27, 2019 Share Posted March 27, 2019 Hi,I have a code like this:mainReport = JasperFillManager.fillReport(report, invoiceMap, new JREmptyDataSource());tableReport = JasperFillManager.fillReport(table, taskListMap, new JREmptyDataSource());List<JasperPrint> printList = new ArrayList<>();printList.add(mainReport);printList.add(tableReport);JRPdfExporter exporter = new JRPdfExporter();ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();exporter.setExporterInput(SimpleExporterInput.getInstance(printList)); //Set as export input my list with JasperPrint sexporter.setExporterOutput(new SimpleOutputStreamExporterOutput(System.getProperty("user.home") + "/output.pdf")); //or any other out streaamSimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();configuration.setCreatingBatchModeBookmarks(true); //add this so your bookmarks work, you may set other parametersexporter.setConfiguration(configuration);exporter.exportReport();[/code]But it is exporting the report to a file. I need to change this code so it is returning a byte[] so I can make an rest service endpoint to download the file... But I don't seem to find a method to do this... Link to comment Share on other sites More sharing options...
hozawa Posted March 27, 2019 Share Posted March 27, 2019 Have you tried exporting to ByteArrayOutputStream using export.exportReportToStream() and then converting it to .toByteArray()?http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRPdfExporter.html#exportReportToStream-java.io.OutputStream- Link to comment Share on other sites More sharing options...
Nilam1.K Posted August 9, 2022 Share Posted August 9, 2022 is there any way to sort the printList? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now