aspose file tools*
The moose likes Other Open Source Projects and the fly likes Jasper Report Printing From a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Jasper Report Printing From a Servlet" Watch "Jasper Report Printing From a Servlet" New topic
Author

Jasper Report Printing From a Servlet

Suraj Batuwana
Greenhorn

Joined: Mar 03, 2005
Posts: 3
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 ?

Or Does any body know any other web based printing methods?

Thanks & Regards,
Suraj
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

I am going to move this thread to the Other Open Source Forum. Your question is about JasperReports and not a Servlets direct question.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jasper Report Printing From a Servlet