Need advice about which tool to choose?Ask the StackShare community!
PhantomJS vs wkhtmltopdf: What are the differences?
Developers describe PhantomJS as "Scriptable Headless WebKit". PhantomJS (www.phantomjs.org) is a headless WebKit scriptable with JavaScript. It is used by hundreds of developers and dozens of organizations for web-related development workflow. On the other hand, wkhtmltopdf is detailed as "Convert HTML to PDF using Webkit (QtWebKit)". wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service.
PhantomJS belongs to "Headless Browsers" category of the tech stack, while wkhtmltopdf can be primarily classified under "File Conversion".
PhantomJS and wkhtmltopdf are both open source tools. PhantomJS with 26.9K GitHub stars and 5.7K forks on GitHub appears to be more popular than wkhtmltopdf with 8.4K GitHub stars and 1.17K GitHub forks.
According to the StackShare community, PhantomJS has a broader approval, being mentioned in 77 company stacks & 47 developers stacks; compared to wkhtmltopdf, which is listed in 10 company stacks and 3 developer stacks.
I am using Node 12 for server scripting and have a function to generate PDF and send it to a browser. Currently, we are using PhantomJS to generate a PDF. Some web post shows that we can achieve PDF generation using Puppeteer. I was a bit confused. Should we move to puppeteerJS? Which one is better with NodeJS for generating PDF?
You better go with puppeteer. It is basically chrome automation tool, written in nodejs. So what you get is PDF, generated by chrome itself. I guess there is hardly better PDF generation tool for the web. Phantomjs is already more or less outdated as technology. It uses some old webkit port that's quite behind in terms of standards and features. It can be replaced with puppeteer for every single task.
I suggest puppeteer to go for. It is simple and easy to set up. Only limitaiton is it can be used only for chrome browser and currently they are looking into expanding into FF. The next thing is Playwright which is just a scale up of Puppeteer. It supports cross browsers.
Pros of PhantomJS
- Scriptable web browser13
- Depends on QT3
- No ECMAScript 62