posted 14 years ago
Hi All,
I am trying to print jasper report using Jasperprint api, on server side(this is scheduler job which prints reports at regular intervals without user interaction).the problem i face is while printing it is cutting/removing some of the columns on the right hand side(i mean its not adjusting/fitting/stretching whole report into a page while print).But viewing same report is fine, it displays properly all the columns.
Please let me know if need to call any APIs or any settings.
sample code that i am using:
JasperPrint jp =reportEngine.fillReport() ;//it returns stream
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
printRequestAttributeSet.add(new Copies(1));
PrinterName printerName =new PrinterName("printername", null); //gets printer
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
printServiceAttributeSet.add(printerName);
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, printRequestAttributeSet);
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, printServiceAttributeSet);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE);
exporter.exportReport();
Any suggestions/help is appreciatable.
Thanks,
Surendra