Prawn: PDF generation with progress bar or spinner
I'm using prawn and prawnto for PDF-generation in my rails-app. Is there a way to show th开发者_运维技巧e user a spinner or progress bar while the PDF is generated?? I think about showing a spinner-div in the document with the "generate-pdf-link" when starting the pdf-action and then removing it when the rendering finished (everything e.g. with jquery). How can I trigger that??
Thanks for your help!
Instead of generating the PDF immediately, you could display a result page with a spinner, and generate the pdf in a background job. I recommend the Gems DelayedJob or Resque for creating background jobs, placing them on multiple queues, and processing them later. There are good Railscasts for both. You can use a jQuery Timer plugin to check periodically if the PDF has been generated.
精彩评论