generating pdf hangs on rails 4 using PDFkit gem

后端 未结 3 1541
-上瘾入骨i
-上瘾入骨i 2021-01-02 14:08

I\'m able to download pdf file with:

curl google.com | wkhtmltopdf - test.pdf

so it means, wkhtmlpdf installation was successful.

B

3条回答
  •  -上瘾入骨i
    2021-01-02 14:39

    Setting config.action_controller.asset_host = "http://localhost" in development.rb actually didn't work for me. That is, the PDF generation would work, but then assets wouldn't come through when rendering HTML.

    I followed the method here: http://jguimont.com/post/2627758108/pdfkit-and-its-middleware-on-heroku

    and it worked like a charm for me. Hope this helps someone. Just throw assets.rb in config/intializers and you're good to go.

提交回复
热议问题