Skip to content

Coming from FPDF

Migrating from FPDF

Keep a familiar cell-and-coordinate API; gain HTML, tagging, and signatures.

If you build PDFs with FPDF’s cell-and-coordinate API, NextPDF keeps a familiar cell/setFont API — and adds an HTML/CSS engine, tagged accessibility, and PAdES signatures on the same engine.

Before / after

What your code looks like

FPDF-style drawing

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Helvetica', '', 12);
$pdf->Cell(40, 10, 'Hello');
$pdf->Output('F', 'out.pdf');

NextPDF

use NextPDF\Core\Document;

$doc = Document::createStandalone();
$doc->addPage();
$doc->setFont('helvetica', '', 12);
$doc->cell(40, 10, 'Hello');          // familiar API…
$doc->writeHtml('<h1>…or HTML</h1>'); // …plus an HTML engine
$doc->save('out.pdf');

Honest assessment

What changes, and what doesn't

Stays the same

  • The page / cell / font mental model carries over
  • Coordinate-based drawing is available in NextPDF too

Gets better

  • Render HTML and CSS, in addition to drawing primitives
  • Tagged, signable, archival output on the same engine

Needs attention

  • Method names are camelCase (addPage, setFont, cell); port your drawing calls

Effort: A guided rewrite: the cell/font API is similar, and many documents become a short HTML template.

What you gain

Why the move is worth it

  • NextPDF's PDF 2.0 (ISO 32000-2) engine
  • Tagged output for accessibility (targeting PDF/UA)
  • PAdES B-B signing in Core; B-T in Pro; B-LT/B-LTA in Enterprise
  • Strict types, PHPStan Level 10, and active maintenance