JasperPrintManager.printReport fit to page


Hello. I have a problem when I try to print a Jasper PDF.

If I use the JRPdfExporter function, I have a problem trying to display the print box using the following code

JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, "this.print({bUI: true,bSilent: false,bShrinkToFit: true});");   

The problem I have in this example is that the print dialog is not shown in internet explorer. I have already verified that the problem is caused when protected mode is enabled in both internet explorer and adobe acrobat. The problem is that I cannot ask all the users of the application to disable that option.

After encountering this error I tried to program my function in another way, using the following code

JasperPrint print = null;
print = JasperFillManager.fillReport(url.getPath(), datosListado, srDs);
JasperPrintManager.printReport(print, true);

The problem I have when doing it this way is that the width of the report in the jrxml file is greater than the print size and the text is cut off. I cannot change the template because it is common to multiple processes. Could it be adapted depending on the size of the printer sheet?


noe.montes.developer's picture
Joined: Aug 6 2020 - 5:09am
Last seen: 1 month 2 weeks ago

0 Answers:

No answers yet