marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.55k stars 544 forks source link

QR code not visible over generated pdf post ami upgrade #692

Open srrao11 opened 1 year ago

srrao11 commented 1 year ago

I have recently migrated my ec2 instance from ami1 to ami2. Post upgrade the qr code (which is usually a byte array) is not getting generated. Also during upgrade i was getting error like :

{
"stack": "Error: /opt/boson/userTravellerProfile/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory\n\n    
 at ChildProcess.<anonymous> (/opt/boson/userTravellerProfile/node_modules/html-pdf/lib/pdf.js:121:17)\n    
 at emitTwo (events.js:126:13)\n    at ChildProcess.emit (events.js:214:7)\n    
 at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)",
"message": "/opt/boson/userTravellerProfile/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory\n"
}

So i installed fontconfig : sudo yum install -y fontconfig

srrao11 commented 1 year ago

The qr code is present as an html image tag <img src='some-url'> which fetches byte array from an url.

srrao11 commented 1 year ago

Instead of passing <img src='some-url'>. now i am passing base64 encoded string like <img src="data:image/jpg;base64,<encoded-string>" >