TCPDF: 291 methods delegated, and a fonts directory you have to generate
Deprecated: PHP PDF library, superseded by tc-lib-pdf (https://github.com/tecnickcom/tc-lib-pdf)
At a glance
- What is it?
- tecnickcom/TCPDF is a pure-PHP PDF and barcode library that is now in maintenance-only mode. Since version 7 the class holds no PDF engine of its own: every public method delegates to tc-lib-pdf, legacy font files are gone, and the font assets have to be generated by your own composer.json.
- Who is it for?
- Stay on TCPDF if your product already depends on it and you need a patched dependency while a migration runs in phases, since the 291 public signatures are unchanged and existing calls keep working. Do not adopt it for new work: the project says to start with tecnickcom/tc-lib-pdf.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly PHP, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- tecnickcom/TCPDF4,521 ★ · -10
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| tecnickcom/TCPDF | 4.5k | 4.5k |
-10 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Version 7 turned the class into a facade
The architectural change is stated without euphemism: starting with version 7, the TCPDF class no longer contains its own PDF engine. It is a compatibility facade in which every public method is a thin wrapper delegating actual PDF generation to the modern tecnickcom/tc-lib-pdf engine, the class named \Com\Tecnick\Pdf\Tcpdf, while a small internal state layer reproduces the legacy stateful model: current X and Y, margins, fonts, colors, automatic page breaks, and headers and footers. That state layer is the part worth understanding, because it is what makes old code keep behaving the way it did. The public API is mostly unchanged, with all 291 public method signatures identical to legacy TCPDF in names, parameters and defaults, so integrations continue to call new TCPDF(...), AddPage(), SetFont(), Cell(), writeHTML() and Output() as before. Exactly one method is new: getPDFFilename(), which returns the file name Output() used after the engine sanitizes it.
MAPPING.md sorts every method into five statuses
The part that makes this migration auditable is a table, and the table is machine-verified against the class rather than maintained by hand. MAPPING.md carries the status of every public method with notes, using five labels: delegated, adapter, shim, intentional-noop and blocked. If you are auditing an existing integration, that file is where you find out which of your calls are real and which have quietly become nothing. Rendering itself, by contrast, is entirely the modern engine's work: text layout, HTML and CSS, fonts, graphics, barcodes, encryption, signatures and output generation all come from the tc-lib-* libraries rather than from this repository.
Output is structurally equivalent, not byte-identical
The compatibility promise has a deliberate limit, and it is the limit most likely to surprise you. Documents render with the same page sizes and content, but the modern engine's line-breaking and font metrics can differ slightly from the legacy implementation, and long flowing documents may paginate one page earlier or later. For an invoice or a report that nobody diffs, that is invisible. For a document whose page breaks are asserted in a test, or whose signature must land on a known page, it is a real change. The second half of the notice lists what is intentionally not reproduced: legacy font definitions, EPS and AI vector import, always-on stream compression, policy-based local file access, and assorted no-ops. Those are not bugs pending a fix; they are the places where the modern engine's model takes precedence, and they are exactly the cases to check before assuming a drop-in upgrade.
Font assets are generated, not shipped
This is the sharpest operational consequence, and it hits deployments rather than developers. Font loading moved to the tc-lib font stack, the repository-shipped fonts/ assets are removed, and assets come from tecnickcom/tc-lib-pdf-font under vendor/tecnickcom/tc-lib-pdf-font/target/fonts/. They are generated at install time and are not shipped in the package, because Composer runs only the scripts the root project declares. So a project that requires TCPDF has to declare the generation itself:
{
"scripts": {
"tc-lib-pdf-fonts": [
"[ -d vendor/tecnickcom/tc-lib-pdf-font ] && make -C vendor/tecnickcom/tc-lib-pdf-font deps fonts || true"
],
"post-install-cmd": [
"@tc-lib-pdf-fonts"
],
"post-update-cmd": [
"@tc-lib-pdf-fonts"
],
"post-autoload-dump": [
"@tc-lib-pdf-fonts"
]
}
}That covers composer install, update, require and dump-autoload. To generate once from the project root:
make -C vendor/tecnickcom/tc-lib-pdf-font deps fontsIn a checkout of this repository the Makefile targets are make deps, make fonts to initialize only when missing, and make fonts-rebuild to force a full rebuild. The sentinel to check is vendor/tecnickcom/tc-lib-pdf-font/target/fonts/core/helvetica.json, and its absence shows up at runtime rather than at install time, reported as unable to read file: helvetica.json on the first page.
Legacy PHP font descriptors no longer load
Three groups of deployments are named as affected by the font move, and each fails differently. Deployments that relied on local fonts/ files without Composer dependencies now have no fonts at all. Applications with custom K_PATH_FONTS assumptions tied to a repository relative fonts folder point at a directory that no longer exists. And integrations using custom or generated font definitions that expect PHP-only descriptor files hit the hardest wall, because legacy descriptors, a fontname.php paired with a fontname.z, are no longer supported; the instruction is to convert the original TTF or OTF with the tc-lib-pdf-font importer instead. The compatibility notes are more encouraging about the middle ground: TCPDF checks configured font paths as well as tc-lib font assets, and JSON font descriptors from tc-lib are accepted by the AddFont() path. The migration recipe is four steps: install with Composer, confirm the assets exist under vendor/tecnickcom/tc-lib-pdf-font/target/fonts/, keep calling SetFont() and AddFont() while validating that each custom family resolves from tc-lib assets or an explicit path, and update deployment packaging so vendor/ font assets ship to production.
The Makefile is where the platform differences hide
Building the library from a checkout goes through a Makefile that reads like a small build system, and a few of its lines explain platform behaviour better than prose would:
# Project owner
OWNER=tecnickcom
# Project name
PROJECT=tcpdf
# Default port number for the example server
PORT?=8971
# PHP binary
PHP=$(shell which php)
# tc-lib-pdf-font package path and sentinel asset
TCPDF_FONT_PKGDIR=./vendor/tecnickcom/tc-lib-pdf-font
TCPDF_FONT_SENTINEL=$(TCPDF_FONT_PKGDIR)/target/fonts/core/helvetica.jsonThree details are worth noticing. The version is not hardcoded, it is read from the VERSION file in the root, which is why that file is in the tree next to tcpdf.php and tcpdf_autoconfig.php. The in-place sed flag is set differently on Darwin, where it needs the empty argument, so the same target works on macOS and Linux. And the font sentinel is encoded as a Make variable rather than documented in a comment, meaning a build script can test for it. The shell is pinned to /bin/bash with -o pipefail -c, and Composer is invoked through the PHP binary with apc.enable_cli=0, which matters on machines where the CLI APC cache is enabled.
Deprecated, still installed 100M+ times
The status line is blunt and the numbers explain the contradiction. TCPDF is deprecated and in maintenance-only mode, active feature development has moved to tc-lib-pdf, and new projects are pointed at that successor. At the same time the library is still installed more than 100 million times across over 500 PHP packages, so the page asks products that depend on it to sponsor continued maintenance to keep shared infrastructure secure and patched. That combination shapes what a release means: 7.0.21 shipped on 2026-11-02, 7.0.20 on 2026-10-24 and 7.0.19 on 2026-10-17, and the last push to main is 2026-11-02, so maintenance is real and frequent. It is also not feature work. The migration guidance is staged on purpose: new projects install tecnickcom/tc-lib-pdf, existing users keep TCPDF for current production workloads and migrate in phases, and teams wanting modern architecture, Composer-first design and stronger type safety should prioritise the successor. Licensing is GNU LGPL v3 with the text in LICENSE.TXT, authored by Nicola Asuni.
Editorial conclusion
Stay on TCPDF if your product already depends on it and you need a patched dependency while a migration runs in phases, since the 291 public signatures are unchanged and existing calls keep working. Do not adopt it for new work: the project says to start with tecnickcom/tc-lib-pdf. Before deploying, check MAPPING.md for the methods marked noop or blocked, and confirm your font assets are generated in vendor/ rather than shipped from the repository.
Frequently asked questions
What is TCPDF used for?
It is a pure-PHP library for generating PDF documents and barcodes directly in application code, covering text rendering, page composition, graphics, signatures, forms and standards-oriented output. The package is tecnickcom/tcpdf and the author is Nicola Asuni.
How do I install TCPDF with composer?
New projects should install tecnickcom/tc-lib-pdf instead, the modern successor, because TCPDF is deprecated and in maintenance-only mode. If you keep TCPDF, add a script to your own composer.json that runs make -C vendor/tecnickcom/tc-lib-pdf-font deps fonts on post-install-cmd, post-update-cmd and post-autoload-dump, since font assets are generated at install time and are not shipped.
Will upgrading to TCPDF 7 change my existing code?
All 291 public method signatures are unchanged, so new TCPDF(...), AddPage(), SetFont(), Cell(), writeHTML() and Output() calls keep working, with one new method, getPDFFilename(). Rendering is done by the tc-lib-pdf engine, so line breaking and font metrics can differ slightly and long documents may paginate one page earlier or later.
What causes the tcpdf error 'unable to read file: helvetica.json'?
The generated font asset directory is missing. The expected sentinel is vendor/tecnickcom/tc-lib-pdf-font/target/fonts/core/helvetica.json, and it is produced by running make -C vendor/tecnickcom/tc-lib-pdf-font deps fonts, or by the make deps, make fonts and make fonts-rebuild targets in a checkout of the repository.
Where are the TCPDF examples?
The repository ships numbered PHP examples from example_001.php through example_023.php under examples/, alongside examples/config/ and examples/data/. A test suite sits in test/ with phpunit.xml.dist, and the library entry points are tcpdf.php and tcpdf_autoconfig.php in the root.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/tecnickcom-tcpdf)Star history chart for your README
[](https://hysenlabs.com/projects/tecnickcom-tcpdf)Was this useful?