问题
I'm trying to generate a PDF using WickedPDF and all of my static HTML/CSS is loading. I have a few elements on the page that are populated using AJAX requests, but they are not showing up in the PDF.
I know :redirect_delay can be passed as a parameter, but this does not help in the case of waiting for my AJAX calls to finish. Since I didn't see any mention of Wicked PDF and pages generated from AJAX calls, I figured I'd ask:
Is what I'm trying to do possible with Wicked PDF (or other projects), or do I have to pass everything to the front end before generating a PDF?
回答1:
This should work:
render :pdf => 'out.pdf',
:javascript_delay => 5000
来源:https://stackoverflow.com/questions/13372946/wicked-pdf-wait-for-ajax-request-to-finish