scsbatu
Member since : Mar 4, 2005
Messages : 1
|
Mar 4, 2005 at 4:34 AM
Hi ,
I have used Jasper Reports to Print from the Servlet
My code is as follows
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
PrintService[] pservices = PrintServiceLookup.lookupPrintServices( flavor, aset);
if (pservices.length > 0) {
DocPrintJob pj = pservices[0].createPrintJob();
JasperPrint jPrint = JasperFillManager.fillReport("Test.jasper",parameters,getConnection());
JasperPrintManager.printReport(jPrint, false);
}
But I have experience the following exception as
net.sf.jasperreports.engine.JRException: Invalid page index range : 0 - -1 of 0
at net.sf.jasperreports.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:170 )
at net.sf.jasperreports.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:131 )
at net.sf.jasperreports.engine.JasperPrintManager.printPages(JasperPrintManager.ja va:392)
at net.sf.jasperreports.engine.JasperPrintManager.printReport(JasperPrintManager.j ava:283)
Any idea on this ?
Thanks & Regards,
Suraj
|