I am using wickedpdf gem for generating pdf's in my rails application. Every thing runs normally, except for few requests on production fail, with the following error log.
Error: Failed to execute: ["/usr/local/bin/wkhtmltopdf", "-q", "--page-size", "A4", "--margin-top", "20", "--margin-bottom", "25", "--margin-left", "0", "--margin-right", "0", "--footer-spacing", "5", "--footer-html", "file:////tmp/wicked_footer_pdf20160714-2229-1bb7qcg.html", "file:////tmp/wicked_pdf20160714-2229-18kjik5.html", "/tmp/wicked_pdf_generated_file20160714-2229-1t66b4y.pdf"] Error: PDF could not be generated! Command Error: terminate called after throwing an instance of 'std::bad_alloc'
I am not able to reproduce this on my local/staging.
The following is my setup:
Production server running on Centos 7 on AWS-EC2. Copied wkhtmltopdf binary for linux 64-bit from http://wkhtmltopdf.org/downloads.html to /usr/local/bin/wkhtmltopdf with version 0.12.0. Added initializer for Wickedpdf to point to wkhtmltopdf.
We had the same issue with wkhtmltopdf-0.12.2.1. Also PDFs were rendering very slow
wkhtmltopdf v0.12.0-0.12.2 uses high resolution (about 1200dpi) to print PDFs which caused slow rendering issue. In the version 0.12.3 the resolution was dropped to 72dpi which fixed the performance issue (See this issue for the details)
Upgrade to v0.12.4.0 fixed the Command Error: terminate called after throwing an instance of 'std::bad_alloc' either
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With