Migration · wkhtmltopdf
Move from wkhtmltopdf
Move HTML-to-PDF generation into PHP, or keep a browser engine through an extension.
Engineering diff
Map the calls you already use
NextPDF renders directly in your PHP process. Cloudflare and Chrome extensions add browser-engine paths for documents that need them.
Snappy wkhtmltopdf wrapper and generateFromHtml example (opens in a new tab) (verified 2026-08-05)
call-site.phpBefore → after
wkhtmltopdf (Snappy)
use Knp\Snappy\Pdf;
$snappy = new Pdf('/usr/bin/wkhtmltopdf');
$snappy->generateFromHtml($html, 'out.pdf');NextPDF (in-process)
use NextPDF\Core\Document;
$doc = Document::createStandalone();
$doc->addPage();
$doc->writeHtml($html); // Render inside the PHP application process
$doc->save('out.pdf');Migration map
Keep, add, review
Compatible surface
- Map Snappy generateFromHtml to NextPDF writeHtml and save
NextPDF capability
- In-process: the renderer ships and runs with the PHP application
- Use the Artisan (Chrome) or Cloudflare extensions for browser-backed rendering
Review in your code
- Pages that relied on JavaScript execution should use the Chrome/Cloudflare rendering extensions
Effort: A guided rewrite: replace the shell-out with an in-process render, or point at the Chrome/Cloudflare extension for JS-heavy pages.
NextPDF surface
Available after the move
- NextPDF’s PDF 2.0 (ISO 32000-2) engine
- Emit tagged structure targeting PDF/UA-2 so the document carries its semantics
- PAdES B-B signing in NextPDF Core; B-T in NextPDF Pro; B-LT/B-LTA in NextPDF Enterprise
- Strict types, a PHPStan Level 10 CI command, and active maintenance
After mapping your calls, compare editions to choose the capability set for your application.