• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Download PDF

 
Neil Muya
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

Good Day guys!

This is actually related to this topic.

Currently i am using a simple design of downloading a pdf.
Passing the request via submit form.
And same thing with the servlet used by Kimon Pi.

But I'm quite troubled right now, because aside from having this download pdf feature.
My page also has a Javascript Refresh Timer(every 20 seconds the page refreshes).

So my problem is , when a user clicks on download pdf, a download browser window will pop out.
When the user doesn't do anything with the download window within 20 seconds the page refreshes.
But the problem is as long as the download window is still open the page looks freezed, so sadly the page does not
do a refresh. So my javascript timer is busted once the user does that.

What I was thinking, was to use ajax to call the controller, but before calling the controller I will clear the timeout,
and then maybe I can handle the response outputstream and activate the timer once finished,
but I think javacript can't handle that.

So maybe you guys have some ideas, on how to handle the Outputstream in javascript,
or maybe how to handle the download window of the browser ,
like when window.ok restart timer?


Thanks in advance!
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using AJAX to download the PDF -- an idea which was covered quite comprehensively in that other thread you linked to, for anybody who cared to read it -- why not just stop the timer when the download button is clicked?
 
Neil Muya
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thanks for the reply,

Yep actually thats what I did, i stopped the timer when user clicks on download pdf.
But the problem is , where should I put the code to restart the timer after the user downloads the file.

What I really want to achieve is, when user clicks on download, stop the timer,
and then when user decided to save or open the pdf thats the time i'll restart the refresh page timer.\

Any ideas guys?



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic