Skip to content

Migration · TCPDF

Move from TCPDF

Change the compatibility import, run your suite, then move document by document.

Engineering diff

Change the compatibility import

TCPDF has 112M+ installs. The nextpdf/compat-legacy adapter preserves selected TCPDF 6.2.13 call signatures, including method names, parameter order, and defaults. Most call sites change only their import line.

TCPDF total installs: 112,272,543 (Packagist “Overall”) (opens in a new tab) (verified 2026-07-27)

call-site.phpBefore → after

Your TCPDF code

use TCPDF;

$pdf = new TCPDF('P', 'mm', 'A4');
$pdf->SetFont('helvetica', '', 12);
$pdf->AddPage();
$pdf->writeHTML($html);
$pdf->Output('invoice.pdf', 'F');

Compatibility import

// Import the compatibility adapter
use NextPDF\Compat\Tcpdf\TCPDF;

$pdf = new TCPDF('P', 'mm', 'A4');
$pdf->SetFont('helvetica', '', 12);
$pdf->AddPage();
$pdf->writeHTML($html);
$pdf->Output('invoice.pdf', 'F');

Compatibility surface

A tested compatibility surface

The adapter’s compatibility matrix surveys approximately 120 TCPDF 6.x methods.

94
methods delegated run on the PDF 2.0 engine

The adapter preserves the selected TCPDF surface. NextPDF produces the document with an independent PDF 2.0 implementation. Run your existing call sites, then migrate file by file.

Migration map

Keep, add, review

Compatible surface

  • Selected method calls retain TCPDF 6.2.13 parameter order and defaults
  • Header()/Footer() override by extending the class
  • Enumerated legacy K_* / PDF_* constants and helper classes

NextPDF capability

  • Runs on the PDF 2.0 engine underneath
  • Error() throws a catchable exception. Enable HTML calls explicitly
  • Access the fluent API through $pdf->getDocument()

Review in your code

  • Review the adapter’s enumerated method matrix against your call sites

Effort: Change the import (or enable global aliases) and run your suite. Then review the adapter’s method matrix against your call sites.

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.