Instead of immediately creating a PDF file, you can display a results page with a counter and create a PDF document in a background job. I recommend Gems DelayedJob or Resque for creating a background of tasks, placing them in several queues and subsequent processing. There are good Railscasts for both. You can use the jQuery Timer plugin to periodically check if a PDF file has been created.
source
share