JasperReports - Is it possible for a report to be listed multiple times automatically?

0

I have a report that is nothing more than an invoice, with your items and note data and items. A feature was requested that when selecting more than one invoice, this report manages the template of each note in a PDF just so the user massively prints the list of selected notes.

I looked at the JasperReports website and tried using sub reports by copying the contents of the other JRXML (iReport source), tried some method of using this JRXML as content embedded in the other report listing my objects on top of them, but also unsuccessful . Is it possible that this is done? If so, how?

    
asked by anonymous 30.11.2015 / 18:49

1 answer

0

If there are multiple reports and you just want to export them all together you can use the batch export example from jasper according to this link: link

One possible example would be:

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    JRPdfExporter pdfExporter = new JRPdfExporter();
    pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
    pdfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
    pdfExporter.setParameter(JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, Boolean.TRUE);
    pdfExporter.exportReport();
    InputStream is = new ByteArrayInputStream(os.toByteArray());

Where jasperPrintList would be a list of objects of type JasperPrint that you can fill in the report as follows

JasperPrint impressao = JasperFillManager.fillReport("caminho_do_arquivo_jasper", new HashMap(), new JREmptyDataSource());
    
03.02.2016 / 15:34