dany Posted June 3, 2010 Share Posted June 3, 2010 Sometimes JasperPrintManager.printReport() and JRPrintServiceExporter.exportReport() produce different results. When I print to default printer using JasperPrintManager.printReport() it's all fine. But when I print to a specific printer using JRPrintServiceExporter.exportReport() it's produce the different result - the last 3cm on the page not printing at all. I deep in Jasper sources and find that call JasperPrintManager.printReport() ends in JRPrinterAWT.printPages when magic happens. But method JRPrintServiceExporter.exportReport() not using JRPrinterAWT.printPages and do all work itself. Therefore the Jasper prints to default printer and to the specific printer in different ways. What's the right way using JRPrintServiceExporter.exportReport()? if (jasperPrinter == null) JasperPrintManager.printReport(jasperPrint, withPrintDialog);else { PrintService printService = printOptions.getPrintService(jasperPrinter); JRExporter exporter = new JRPrintServiceExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, printService); exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE); exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE); exporter.exportReport();} Post Edited by dany305 at 06/03/2010 15:51Post Edited by dany305 at 06/03/2010 15:53Post Edited by dany305 at 06/10/2010 12:31 Link to comment Share on other sites More sharing options...
lucianc Posted June 17, 2010 Share Posted June 17, 2010 That might be caused in a bug in JRPrintServiceExporter that doesn't properly set the page size. Log it as a bug using the trackers and stay tooned for the fix.Regards,Lucian Link to comment Share on other sites More sharing options...
angelbetance999 Posted April 22, 2012 Share Posted April 22, 2012 Hi Lucian I have the same problem of dany305. I use the jasperreport version 4.5.1, it's too long for a bug. in iReport its ok in my app using JRPrintServiceExporter fail. 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