Reputation: 113
I am using pdfkit middleware on Heroku to generate pdf. How can i make pdf generating thing as a background job.
def index
@products = Product.all
respond_to do |format|
format.html
format.pdf
end
end
Upvotes: 2
Views: 430
Reputation: 37507
It's not so simple what the other answers are suggesting in fact.
Implementing delayed job for PDF generation is all well and good. But you have more things to consider - you pass the process over to DJ and the end result is a PDF is generated. But you have to then get that PDF back infront of the user - either by polling the job for when it completes and then providing a link to the pdf possibly, or sending them an email to collect the PDF.
Upvotes: 1