wood burning stoves 2.0*
The moose likes Java in General and the fly likes Printing a pdf file in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing a pdf file in Java" Watch "Printing a pdf file in Java" New topic
Author

Printing a pdf file in Java

Victor Gonzalis
Greenhorn

Joined: Feb 15, 2013
Posts: 5
Hello,
I'm trying to print a pdf file using flying saucer, the object PrintableCheck contains all the information of the transaction which needs to be printed. The code works perfectly fine but the problem is that it takes too long to pop up the print dialog.
Is there anything I can modify the below code to make it work faster?
Thanks in advance!

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10916
    
  12

"too long" is not very precise. How long should it take? How long does it take?

More importantly, how do you know that this code is what is causing the slowdown? Unless you've run it through a profiler, you shouldn't even be thinking about optimizing this code...the real problem might be somewhere else.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Victor Gonzalis
Greenhorn

Joined: Feb 15, 2013
Posts: 5
fred rosenberger wrote:"too long" is not very precise. How long should it take? How long does it take?

More importantly, how do you know that this code is what is causing the slowdown? Unless you've run it through a profiler, you shouldn't even be thinking about optimizing this code...the real problem might be somewhere else.


Thank you for the quick response, the time to pop up the dialog varies, sometimes it pops up within 30 sec, and sometimes it takes more than 7 minutes which is too long. When I clear the cache, the print dialog pops up quicker(3-30 seconds).
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
This code creates a PDF, it doesn't open or print anything AFAICT. Which software do you use to print the PDF?


Ping & DNS - updated with new look and Ping home screen widget
Victor Gonzalis
Greenhorn

Joined: Feb 15, 2013
Posts: 5
Ulf Dittmer wrote:This code creates a PDF, it doesn't open or print anything AFAICT. Which software do you use to print the PDF?

Thank you for the answere I was under the impression that the below code triggers the printer. I use Microsoft XPS Document Writer (I have no idea about the software)

Victor Gonzalis
Greenhorn

Joined: Feb 15, 2013
Posts: 5
Victor Gonzalis wrote:Hello,
I'm trying to print a pdf file using flying saucer, the object PrintableCheck contains all the information of the transaction which needs to be printed. ....



thank you all for your help, This question is resolved.!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing a pdf file in Java
 
Similar Threads
flying saucer not converting cellspacing html property properly into pdf
Flying Saucer and Itext
ERROR: 'The reference to entity "L" must end with the ';' delimiter.'
Client side - silent print of PDF
how to change existing pdf font encoding (multi language) dynamically