Migration · mPDF
Move from mPDF
Map mPDF’s WriteHTML call to NextPDF’s writeHtml API, then validate each template.
Engineering diff
Map the calls you already use
NextPDF accepts HTML through its writeHtml API. Map the call, then validate each template.
mPDF WriteHTML and Output reference (opens in a new tab) (verified 2026-08-05)
call-site.phpBefore → after
mPDF-style write-HTML
use Mpdf\Mpdf;
$mpdf = new Mpdf();
$mpdf->WriteHTML($html);
$mpdf->Output('out.pdf', 'F');NextPDF
use NextPDF\Core\Document;
$doc = Document::createStandalone();
$doc->addPage();
$doc->writeHtml($html);
$doc->save('out.pdf');Migration map
Keep, add, review
Compatible surface
- Map mPDF WriteHTML to NextPDF writeHtml
- Map page setup and document metadata through NextPDF’s API
NextPDF capability
- Enterprise output targets PDF/A-4 through its archival structures
- Worker-safe for Octane / FrankenPHP / RoadRunner
Review in your code
- Review any CSS or custom tags specific to your previous renderer
Effort: A guided rewrite: swap the writer, then validate your templates render as expected.
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.