Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to asynchronously create PDF in web applications?

 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a PDF file dynamically
using the data from the database, it might take from 5 sec to 10 min. Meanwhile, I don't like to wait idle, any solution?

any help appreciated!!
 
Lee Wright
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the apache FOP services: http://xml.apache.org/fop/

You would construct an XML file from a database call and then create an fo stylesheet to render it to PDF.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't push the data from the server to the client so you'll have to wait.
Only alternative would be to have the user enter an email address and use JavaMail to send them the PDF as an email attachment.
 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use library PD4ML ...
 
Dharmanand Singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:
You can't push the data from the server to the client so you'll have to wait.
Only alternative would be to have the user enter an email address and use JavaMail to send them the PDF as an email attachment.


He means to say that you can't send the response without any request. So, either the user will have to wait for the response after placing the request or a thread can be spawned at server side that runs asynchronously and composes the PDF file and then send this file through email which can be taken as a input parameter from the user. In the later case, the user will not have to wait for the time that is used in composing the PDF as that task has been delegated asynchronously to an independent thread.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!