I'm trying to use PDFKit.
It looks fairly straightforward so I'm trying to follow Ryan's Rails cast.
So I added the gem to my GemFile and updated my application.rb
with:
config.middleware.use "PDFKit::Middleware"
After that I installed wkhtmltopdf on linux with:
apt-get install wkhtmltopdf
And I make sure it works:
[nicolas@Minto]%wkhtmltopdf www.google.com gogole.pdf
Loading page (1/2)
Printing pages (2/2)
Done
Everything looks good until I try to add the .pdf on one of my pages...
The website stays in a loading state forever. When I stop the server with a Ctrl - C
in the console, I get the following error:
RuntimeError (command failed: "/usr/bin/wkhtmltopdf" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" "0.75in" "--margin-left" "0.75in" "--encoding" "UTF-8" "--print-media-type" "--quiet" "-" "-"):
pdfkit (0.5.2) lib/pdfkit/pdfkit.rb:71:in `to_pdf'
pdfkit (0.5.2) lib/pdfkit/middleware.rb:21:in `call'
What am I doing wrong?