Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject Jasper Report Printing from a Servlet

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


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation