• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Generating PDF and displaying it ...

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The probelm might be with
response.setContentType("text/msword");
The content type should be application/pdf

Can you give the error messages?
 
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
manasa teja
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody..
please help me on this..
thanks
MT
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by manasa teja:
Anybody..
please help me on this..
thanks
MT


Please read this thread https://coderanch.com/t/355076/Servlets/java/Wait-Screen and search for "wait screen" in servlets forum.
 
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HAs anyone have any suggestions on how to about this?
 
No more fooling around. Read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic