Skip to content

Coming from TCPDF

Migrating from TCPDF

Over 109 million installs — and the warmest migration path we offer.

TCPDF is among the most-installed PHP PDF libraries (over 109 million installs). The nextpdf/compat-legacy adapter keeps TCPDF’s class name, method names, parameter order, and 6.2.13 default values, so most call sites change only their import line.

TCPDF total installs: 109,519,753 (Packagist “Overall”) (verified 2026-06-27, opens in a new tab)

TCPDF-shaped compatibility adapter — it keeps the class and method surface, so most call sites change only their import; the compatibility surface is classified, enumerated, and tested (breakdown below).

terminal
composer require nextpdf/compat-legacy

Before / after

What your code looks like

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');

One line changes

use NextPDF\Compat\Tcpdf\TCPDF;  // the only change

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

Compatibility surface

A known, tested surface — not 100%

The adapter is honest about its limits. Of the ~120 surveyed TCPDF 6.x methods, 113 are classified, enumerated, and tested across three buckets:

94
methods delegatedrun on the PDF 2.0 engine
15
silent-ignorelegacy params accepted, not applied
4
unimplementedenumerated no-ops

Rendered PDF bytes differ — the engine underneath is an independent PDF 2.0 implementation, not TCPDF. The point is to run your existing call sites today and migrate file by file.

Honest assessment

What changes, and what doesn't

Stays the same

  • Class, method names, parameter order, and 6.2.13 defaults
  • Header()/Footer() override by extending the class
  • Legacy K_* / PDF_* constants and helper classes

Gets better

  • Runs on the PDF 2.0 engine underneath
  • Error() always throws (no die()); HTML calls disabled by default
  • Reach the modern fluent API any time via $pdf->getDocument()

Needs attention

  • A small set of rarely-used methods are silent-ignore or unimplemented (enumerated and tested) — review them against your call sites

Effort: Most projects: change the import (or enable global aliases) and run your suite. Plan a short pass to review the enumerated non-delegated methods.

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