This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Generating PDF and displaying it ...

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Anybody..
please help me on this..
thanks
MT
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
HAs anyone have any suggestions on how to about this?
 
Just the other day, I was thinking ... about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!