TL;DR:
- Any suggestions in NodeJS to convert an HTML to PDF or PNG without any headless browser instances.
- Also anyone uses puppeteer in any production environment. I would like to know how the resource utilisations and performance of running headless browser in prod.
Longer version:
In a NodeJS server we need to convert an HTML string to a PDF or PNG based on the request params. We are using puppeteer to generate this PDF and PNG (screenshot) deployed in a google cloud function. In my local running this application in a docker and restricted memory usage to 100MB and this seems working. But in cloud function it throws memory limit exception when we set the cloud function to 250MB memory. For a temporary solution we upgraded the cloud function to 1 GB.
We would like to try any alternatives for puppeteer without any headless browser approach. Another library PDF-Kit looks good but it have canvas api kind of input. We can't directly feed html.
Any thoughts or input on this
question from:
https://stackoverflow.com/questions/65914148/convert-html-to-pdf-or-png-without-headeless-browser-instance-in-nodejs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…