zakird / wkhtmltopdf_binary_gem

Ruby gem containing easily installable access to wkhtmltopdf application
https://rubygems.org/gems/wkhtmltopdf-binary
Apache License 2.0
184 stars 346 forks source link

Docker ARM64 linux machine wkhtmltopdf 0.12.6.6 is not working #164

Closed maniSHarma7575 closed 6 months ago

maniSHarma7575 commented 1 year ago

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.

alex-startengine commented 1 year ago

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.

maniSHarma7575 commented 1 year ago

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.

unixmonkey commented 6 months ago

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.