Skip to content

Migration · FPDF

Move from FPDF

Map FPDF’s AddPage, SetFont, and Cell calls to NextPDF, then validate each document.

Engineering diff

Map the calls you already use

NextPDF provides camelCase drawing methods for FPDF-style page, font, and cell calls. Map each call, then validate the document.

FPDF AddPage, SetFont, Cell, and Output example (opens in a new tab) (verified 2026-08-05) · FPDF Output reference (opens in a new tab) (verified 2026-08-05)

call-site.phpBefore → after

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');          // Mapped drawing call
$doc->writeHtml('<h1>HTML</h1>');     // Optional HTML path
$doc->save('out.pdf');

Migration map

Keep, add, review

Compatible surface

  • Map FPDF AddPage, SetFont, and Cell to NextPDF addPage, setFont, and cell
  • Use NextPDF’s coordinate-based drawing API

NextPDF capability

  • Render HTML and CSS in addition to drawing primitives

Review in your code

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

Effort: A guided rewrite: map drawing calls to camelCase methods, then validate each document.

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.