Open bkchovatiya opened 8 years ago
Thank you for including the full error message.
What platform/distribution is your server? The wkhtmltopdf-binary-edge
uses Ubuntu-specific builds of wkhtmltopdf that won't work everywhere (not even all Ubuntu systems - you may need to install other packages like libjpeg
).
If you are using Heroku, there is the wkhtmltopdf-heroku gem, on another system you may need to install a package for your distribution, or build it yourself.
Please let me know how it goes!
i am using cent Os 6.4
Then you should download the CentOS binary from http://wkhtmltopdf.org/downloads.html, and point to it from your initializer.
I might put the binary in /vendor/bin
, and point to it in the initializer like this:
WickedPdf.config = {
exe_path: Rails.root.join('vendor', 'bin', 'wkhtmltopdf').to_s
}
Let me know how it goes!
Now Getting This error RuntimeError (Error: Failed to execute: ["/usr/local/bin/wkhtmltopdf", "-q", "--viewport-size", "1280x1024", "file:////tmp/wicked_pdf20160601-18564-14b4oq.html", "/tmp/wicked_pdf_generated_file20160601-18564-b1t68.pdf"] Error: PDF could not be generated! Command Error: The switch --viewport-size, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display ):
This works for me. However, I needed to call .to_s on the path like so:
exe_path: Rails.root.join('vendor', 'bin', 'wkhtmltopdf').to_s
This prevented the following error: NoMethodError: undefined method `empty?' for #Pathname:0x00000005089940
In Ubuntu 18.04, I fixed this by installing libjpeg-dev
.
I had an issues depending on package libpng12.so.0
which is nolonger suppored in ubuntu 17+.
I had to download it and install manually.
Download Link. https://packages.ubuntu.com/xenial/amd64/libpng12-0/download
Install
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
In Local Itz Work but in Server i Got This Error ["/var/www/vhosts/gearmile.com/.rvm/gems/ruby-2.2.0/bin/wkhtmltopdf", "-q", "--viewport-size", "1280x1024", "file:////tmp/wicked_pdf20160524-64414-6qfz5b.html", "/tmp/wicked_pdf_generated_file20160524-64414-1txla7b.pdf"] Error: PDF could not be generated! .rvm/gems/ruby-2.2.0/gems/wkhtmltopdf-binary-edge-0.12.2.1/libexec/wkhtmltopdf-linux-amd64: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory