wood burning stoves 2.0*
The moose likes Servlets and the fly likes Generating PDF and displaying it ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Generating PDF and displaying it ..." Watch "Generating PDF and displaying it ..." New topic
Author

Generating PDF and displaying it ...

Mufaddal Khumri
Greenhorn

Joined: Jun 13, 2002
Posts: 9
Hi,
I have a servlet that generates a PDF document and then sends it to the clients browser. If the client has a PDF plugin for his or her browser, the PDF document opens in the client's browser window, else the client gets a dialog box asking him to save the PDF document to his or her hard disk.
In my web application the client clicks a link which invokes a smaller child window for the PDF to be displayed in. The problem I am facing is that while the PDF is being generated, I need to show the client some kind of notification in this child browser window - Some message like -"Please wait while the document downloads" or something to that tune, could be a gif image of some sort. How do I do this ?
I tried one approach that is i write the header information in my servlet and flush that, so that the client gets that information and starts displaying the PDF as its being genrated, but that did not work. The PDF gets generated sent and then only does it appear in the child window.
Any help on this will be appreciated.
Thanks.
[ September 21, 2003: Message edited by: Mufaddal Khumri ]
clyde melly
Ranch Hand

Joined: Sep 04, 2003
Posts: 152
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
I think you can make use of HTTP page refresh header. While the PDF is being generated, send PDF progress message. And when the PDF generation is complete, send the actual PDF.

I think this solves your problem
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
The probelm might be with
response.setContentType("text/msword");
The content type should be application/pdf

Can you give the error messages?
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Originally posted by Mufaddal Khumri:
Hi,
I have a servlet that generates a PDF document and then sends it to the clients browser. If the client has a PDF plugin for his or her browser, the PDF document opens in the client's browser window, else the client gets a dialog box asking him to save the PDF document to his or her hard disk.
In my web application the client clicks a link which invokes a smaller child window for the PDF to be displayed in. The problem I am facing is that while the PDF is being generated, I need to show the client some kind of notification in this child browser window - Some message like -"Please wait while the document downloads" or something to that tune, could be a gif image of some sort. How do I do this ?
I tried one approach that is i write the header information in my servlet and flush that, so that the client gets that information and starts displaying the PDF as its being genrated, but that did not work. The PDF gets generated sent and then only does it appear in the child window.
Any help on this will be appreciated.
Thanks.
[ September 21, 2003: Message edited by: Mufaddal Khumri ]

Did anyone have any solution fore this.. I also have to implement the same.. How can I achieve this.. by thebye, I am using servlet and Itext to generate teh report.. Ho wto open a new window to and show the report there...
Thanks for ur help!!
MT
[ October 22, 2003: Message edited by: manasa teja ]

MT
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Anybody..
please help me on this..
thanks
MT
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by manasa teja:
Anybody..
please help me on this..
thanks
MT

Please read this thread http://www.coderanch.com/t/355076/Servlets/java/Wait-Screen and search for "wait screen" in servlets forum.


Spritle Software Blogs
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
Dynamically Creating PDFs in a Web Application
http://www.onjava.com/pub/a/onjava/2003/06/18/dynamic_files.html
(p.s. - use iText)
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Originally posted by Sean Sullivan:
Dynamically Creating PDFs in a Web Application
http://www.onjava.com/pub/a/onjava/2003/06/18/dynamic_files.html
(p.s. - use iText)


Thanks Sean.. Infact, I used your article only to generate the reports..
Thats a wonderful article!! The example is a really good one !!
In the pdf report, we are generating a table of some 5000/6000 rows. So,the execution time is some 12 seconds. So, our customer wants to show something like "PLease wait.. your reuqets us being processed" and show the report.
And one more thing is that, we have to show this report in a new window.
My doubt is how to open a new window fro servlet and show the report there..
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
HAs anyone have any suggestions on how to about this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating PDF and displaying it ...
 
Similar Threads
XSL-FO hyperlinks in PDF
how to set .xml, .pdf, .xls, and .rpt in response.setContentType(
LoadingBar (or) ProgressBar
HTML to PDF possible?
PDF download ..