Introducing render-vendor
We just published render-vendor
, a faster alternative to wkhtmltopdf when rendering HTML documents to PDFs (or PNGs, JPEGs, BMPs...). With it, you can:
- Generate PDFs in 10s of milliseconds (10-100x faster than several popular solutions);
- Handle jobs asynchronously + in parallel;
- Swap internal components, e.g. Headless Chrome vs. PhantomJS; and
- Integrate easily into modern JS build pipelines (e.g. React, Glimmer, Vue). For example, Ember + Electron projects should consider using
ember-render-vendor
.
Check it out at http://render-vendor.com.
Background
A client wanted an Electron app to print formatted documents like receipts or stickers. Our proposed solution used html-pdf
to render PDFs from HTML files, which would be sent to networked printers.
This first approach benched at ~3s per job, which met requirements but kind of sucked. Users don't like to wait.
On investigation, we found that 90+% of the time was spent waiting for PhantomJS to boot and paint the DOM. Watch the CLI spin:
We engineered. The project we delivered:
- Prints jobs in 50ms or less; and
- Wraps core dependencies with a minimal API that prevents vendor lock-in; by:
- Booting a PhantomJS
Renderer
; which - Manages a fleet of
Page
s; each of which load()
s a Glimmer app; that- Subscribes to data updates over websocket; and
- May be
render()
ed to PDF and shipped to the printer at any time.
- Booting a PhantomJS
We're excited to publish the project as render-vendor
; we hope Node.js apps and libraries find it useful when reasoning about parallel renderer processes.
We've also published ember-render-vendor
, which uses EmberCLI to simplify integration with Ember apps running in Node.js (vs. browser) environments.