Any answers on the original question of getting the partials to work still with render_to_string still appreciated. This has the disadvantage of turning off javascript for every PDF I generate, but it'll do for now. Is there any way to do this and keep the partials? Send_data(kit.to_pdf, :filename => "test_pdf", :type => "application/pdf", :disposition => 'attachment') So far everything is up and running smoothly except for one issue. You have an html page setup to display the record. This example assumes the following: wkhtmltopdf and wkhtmltoimage are already installed and accessible on in the PATH. This also uses PDFKit and WebSnap gems available on GitHub. #PDFKIT RAILS HOW TO#Viewed 990 times 1 Im working on deploying my rails application on an Ubuntu server with Apache2 and Passenger. I am going to show you how to generate both a pdf and image from a single action in a controller using the awesome, wkhtmltopdf library. Ask Question Asked 5 years, 8 months ago. Kit = PDFKit.new(html, :disable_javascript => true ) Rails - PDFkit not working in production. Here is the code in my controller's show action: I've also tried putting the partials in the same directory with to no avail. If I remove the references to the partials, it works fine. Internally, PDFKit uses wkhtmltopdf (WebKit HTML to PDF), an engine that will take HTML and CSS, render it using WebKit, and output it as a PDF with high. However, whenever I try, it fails because it says the partials in my view () are missing: I'm trying to create a PDF with PDFKit without using the middleware so I can disable javascript (there's an accordion action in there that hides a lot of info that should be on the PDF).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |