Moving from wkhtmltopdf to a Modern PDF API
wkhtmltopdf is deprecated and uses an ancient WebKit engine. Here's how to migrate to a modern solution without rewriting your templates.
The end of wkhtmltopdf
wkhtmltopdf was the go-to command-line tool for HTML-to-PDF conversion for over a decade. But it's now officially deprecated, and for good reason: it uses a forked version of WebKit from 2012. That means no flexbox, no CSS Grid, no modern CSS features, and known security vulnerabilities.
If you're still using wkhtmltopdf, here's the good news: migrating to pdfRelay requires zero template changes. Your HTML and CSS stay exactly the same. You just point to an API instead of shelling out to a binary.
Before (wkhtmltopdf)
const { execSync } = require('child_process');
const fs = require('fs');
fs.writeFileSync('/tmp/input.html', html);
execSync('wkhtmltopdf /tmp/input.html /tmp/output.pdf');
const pdf = fs.readFileSync('/tmp/output.pdf');
After (pdfRelay)
const res = await fetch('https://pdfrelay.com/api/v1/convert', {
method: 'POST',
headers: { 'Authorization': 'Bearer sk_live_...', 'Content-Type': 'application/json' },
body: JSON.stringify({ source: 'html', content: html }),
});
const pdf = await res.arrayBuffer();
Same HTML. Better output. Modern CSS support. No binary to install, no temp files, no security patches to worry about. And you get features wkhtmltopdf never had: document hosting, e-signatures, batch processing, and webhooks.