I am upgrading my servers to Amazon Linux 2023 from AL2. My application needs wkhtmltopdf and now while trying to install it I see that is not officially released on my specific OS version. I have already tried to install the version for AL2 but after installing all dependencies it still missing libpng.
I tried downloading the .rpm file from https://wkhtmltopdf.org/downloads.html under the AL2 aarch64 and ran sudo yum install wkhtmltox-0.12.6-1.amazonlinux2.aarch64.rpm
. It seems to install correctly but executing a sample wkhtmltopdf google.com google.pdf
fails. Any ideas on how to build wkhtmltopdf in Amazon Linux 2023?
On a side question. I see the Github repositories associated to this library are Archived, should I consider migrating my application's PDF generation to a different lib?
[ec2-user@backoffice ~]$ sudo yum install wkhtmltox-0.12.6-1.amazonlinux2.aarch64.rpm
Last metadata expiration check: 1:02:21 ago on Mon Nov 20 20:13:06 2023.
Dependencies resolved.
===========================================================================================================================================
Package Architecture Version Repository Size
===========================================================================================================================================
Installing:
wkhtmltox aarch64 1:0.12.6-1.amazonlinux2 @commandline 13 M
Installing dependencies:
cairo aarch64 1.17.6-2.amzn2023.0.1 amazonlinux 669 k
fontconfig aarch64 2.13.94-2.amzn2023.0.2 amazonlinux 278 k
fonts-filesystem noarch 1:2.0.5-12.amzn2023.0.2 amazonlinux 9.5 k
freetype aarch64 2.13.0-2.amzn2023.0.1 amazonlinux 412 k
google-noto-fonts-common noarch 20201206-2.amzn2023.0.2 amazonlinux 15 k
google-noto-sans-vf-fonts noarch 20201206-2.amzn2023.0.2 amazonlinux 492 k
graphite2 aarch64 1.3.14-7.amzn2023.0.2 amazonlinux 93 k
harfbuzz aarch64 7.0.0-2.amzn2023.0.1 amazonlinux 843 k
langpacks-core-font-en noarch 3.0-21.amzn2023.0.4 amazonlinux 10 k
libX11 aarch64 1.7.2-3.amzn2023.0.4 amazonlinux 648 k
libX11-common noarch 1.7.2-3.amzn2023.0.4 amazonlinux 152 k
libXau aarch64 1.0.9-6.amzn2023.0.2 amazonlinux 32 k
libXext aarch64 1.3.4-6.amzn2023.0.2 amazonlinux 40 k
libXrender aarch64 0.9.10-14.amzn2023.0.2 amazonlinux 27 k
libfontenc aarch64 1.1.3-15.amzn2023.0.2 amazonlinux 31 k
libjpeg-turbo aarch64 2.1.4-2.amzn2023.0.5 amazonlinux 191 k
libpng aarch64 2:1.6.37-10.amzn2023.0.6 amazonlinux 121 k
libxcb aarch64 1.13.1-7.amzn2023.0.2 amazonlinux 231 k
mkfontscale aarch64 1.2.1-2.amzn2023.0.3 amazonlinux 33 k
pixman aarch64 0.40.0-3.amzn2023.0.3 amazonlinux 194 k
ttmkfdir aarch64 3.0.9-63.amzn2023.0.2 amazonlinux 51 k
xml-common noarch 0.6.3-56.amzn2023.0.2 amazonlinux 32 k
xorg-x11-fonts-75dpi noarch 7.5-31.amzn2023.0.2 amazonlinux 2.7 M
xorg-x11-fonts-Type1 noarch 7.5-31.amzn2023.0.2 amazonlinux 500 k
Transaction Summary
===========================================================================================================================================
Install 25 Packages
Trying:
[ec2-user@backoffice ~]$ wkhtmltopdf
/home/ec2-user/.rvm/gems/ruby-3.2.2/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_centos_6_i386: /home/ec2-user/.rvm/gems/ruby-3.2.2/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_centos_6_i386: cannot execute binary file
[ec2-user@backoffice ~]$ wkhtmltoimage
wkhtmltoimage: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
[ec2-user@backoffice ~]$ which wkhtmltoimage
/usr/local/bin/wkhtmltoimage
[ec2-user@backoffice ~]$ cd /usr/local/bin/
[ec2-user@backoffice bin]$ ls
wkhtmltoimage wkhtmltopdf
[ec2-user@backoffice bin]$ ./wkhtmltopdf
./wkhtmltopdf: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
If you are using docker, the linux generic available on version 12.3 is working for amd64:
If you're using locally a mac M1 that will not work because of the processor architecture, so I use this for development:
I discovered this by trial and error, so hope it helps.