开发者

Prawn: PDF generation with progress bar or spinner

开发者 https://www.devze.com 2023-03-13 15:29 出处:网络
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-d

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消