Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

jasper printReport problem

  Asked By: Dora    Date: Jun 10    Category: Java    Views: 1843
  

I am developing a web application which includes a lots of reports.

Now if I am trying to give this showDialog true in
JasperPrintManager.printReport(jasperPrint, true), the print dialogue is coming
in Server even if i am dealing reports from any client machine.
I want the print dialogue shown on the client machine itself. How this possible?
Also how can I select printers installed on the client machine with this option?

here is my print code:

JRDataSource searchDataSource = new JRSearchDataSource(data);
JasperPrint print = JasperFillManager.fillReport(report, new HashMap(),
searchDataSource);
JasperPrintManager.printReport(print, true);

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Edwin Chavez     Answered On: Jun 10

for loading printers  you can use this part

javax.print.PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);


and for printing you can use this part

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), dataSource);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintService(selectedPrinter);
JRPrinterAWT.printPages(job, jasperPrint, 0, size, true);



there are a lot of way for printing in jasper  for more info you can see jasper report samples

 
Answer #2    Answered By: Burk Martin     Answered On: Jun 10

My application  is web  based. I use your code  and the result is the same that my print  dialogue is coming in Server side when the request is from client. I think may be i can use applet but i don't try it yet.

 
Didn't find what you were looking for? Find more on jasper printReport problem Or get search suggestion and latest updates.




Tagged: