Why does PDFKit/wkhtmltopdf hang but renders PDF as expected when Rails app is killed?

后端 未结 7 1450
無奈伤痛
無奈伤痛 2020-12-04 12:18

Background

After reading around it seemed to me that Prawn is out and wkhtmltopdf is in. It also seems like the PDFKit and wicked_pdf gems for Rails are the new co

相关标签:
7条回答
  • 2020-12-04 13:14

    The fix by scarver2 worked for me as advertised. But I needed a more recent version of wkhtmltopdf. Since the homebrew version still seems outdated (it still hangs on the command line), and since there isn't a recent precompiled binary available, I used the os x build script to compile one myself:

    $ git clone git@github.com:wkhtmltopdf/wkhtmltopdf.git
    $ cd wkhtmltopdf
    $ ./build_osx.sh     # i'm running 10.9.2
    $ bin/wkhtmltopdf --version                                                                                  
    Name:
      wkhtmltopdf 0.12.1-72a9f2066fe9ffd162dec007a4d9b6a5cd63b670
    $ curl www.example.com | bin/wkhtmltopdf - test.pdf  # render pdf of example.com
    $ open test.pdf   # to confirm pdf 
    

    I'm using pdfkit 0.6.2 with Rails 3.2.17. I put the binary in /vendor and, in a pdfkit initializer, pointed to it with config.wkhtmltopdf. So far, so good.

    0 讨论(0)
提交回复
热议问题