node.jslinuxamazon-web-servicesserverwkhtmltopdf

Wkhtmltopdf Not Working on Amazon Linux 2023


I installed wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm on my EC2 instance(t3.xlarge). While using wkhtmltopdf in Node.js, I'm getting the following error:

Error generating PDF: Error: wkhtmltopdf: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
wkhtmltopdf exited with code 127
    at handleError (/var/www/html/Transectra/node_modules/wkhtmltopdf/index.js:161:16)
    at ChildProcess.<anonymous> (/var/www/html/Transectra/node_modules/wkhtmltopdf/index.js:133:7)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)

I tried to install libpng15 but can't able to install it, but I only want this wkhtmltopdf library


Solution

  • I tried to install with def

    dnf install -y https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox-0.12.6.1-3.almalinux9.$(uname -m).rpm
    

    now check version

    wkhtmltopdf --version