wkhtmltopdf_binary_gem icon indicating copy to clipboard operation
wkhtmltopdf_binary_gem copied to clipboard

Docker ARM64 linux machine wkhtmltopdf 0.12.6.6 is not working

Open maniSHarma7575 opened this issue 1 year ago • 2 comments

Description: I'm encountering an issue while using wkhtmltopdf (version 0.12.6.6) along with the wicked_pdf gem (version 1.4.0).

The problem arises on an ARM64 Linux machine, where I'm getting the following error:

RuntimeError: Failed to execute:
["/builds/project-0/bin/wkhtmltopdf", "--javascript-delay", "300", "--page-size", "A4", "--margin-top", "20", "--margin-bottom", "15", "--margin-left", "20", "--margin-right", "20", "--header-spacing", "15", "--header-html", "file:////tmp/wicked_header_pdf20230821-11229-1yq1gxg.html", "--footer-html", "file:////tmp/wicked_footer_pdf20230821-11229-g4skyw.html", "file:////tmp/wicked_pdf20230821-11229-trtvuh.html", "/tmp/wicked_pdf_generated_file20230821-11229-vych6t.pdf"]
Error: PDF could not be generated!
Command Error: qemu-i386: Could not open '/lib/ld-linux.so.2': No such file or directory

Interestingly, the issue doesn't occur on an ARM64 Mac OS system, where everything seems to work fine.

After some investigation, I realized that the problem might be related to the installation of wkhtmltopdf. On the ARM64 Linux machine, I installed wkhtmltopdf using the command apt-get install wkhtmltopdf, and it was successfully placed at the path /usr/bin/wkhtmltopdf.

To address the issue, I modified the wicked_pdf configuration as follows:

WickedPdf.config = { exe_path: "/usr/bin/wkhtmltopdf" }

With this configuration change, the problem was resolved on the ARM64 Linux machine.

However, it's worth noting that the same setup still doesn't work as expected when using wkhtmltopdf directly.

Any insights or suggestions regarding this issue would be greatly appreciated.

maniSHarma7575 avatar Aug 21 '23 06:08 maniSHarma7575

yea, sadly i don't think this gem packages arm64 version, so if you want to use this on an arm64 box, you will need to install via apt and change the config to point to that binary.

alex-startengine avatar Aug 23 '23 18:08 alex-startengine

yea, sadly i don't think this gem packages arm64 version, so if you want to use this on an arm64 box, you will need to install via apt and change the config to point to that binary.

Yes, I have done that.

maniSHarma7575 avatar Aug 25 '23 12:08 maniSHarma7575

Many of the arm64 binaries are now included in the gem as of version 0.12.6.7. Please reopen and let me know if you have any issues.

unixmonkey avatar May 10 '24 02:05 unixmonkey