• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Download PDF

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 28330
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?



 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic