Install
Works with Drupal: ^11.3 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
20.51 KB
MD5: f02cd769711dcc63a3cd396cf09c58a0
SHA-1: c474717ab782d2e89153bcaf6e97277c10794d69
SHA-256: 7303f6ddc512c505966165bbaac21dcb9c6546071fd403779b57df2d6f4cea99
Download zip
30.86 KB
MD5: 72db344711e6cbbf8c56e418de0ead94
SHA-1: cbed535d663ea78e32f5368db3777fba7cb98b30
SHA-256: 6fdb4b7e2faface03333efa899ca146291afa2c2588ea5efe5f6d609c057eacb
Release notes
TCPDF 7 support. TCPDF 6, used by the 2.x releases, has reached end of life and receives no security fixes anymore (TCPDF#867). TCPDF 7 keeps the TCPDF API but renders with tc-lib-pdf, and it needs font files that sites have to build themselves.
Upgrade notes
- Build the fonts before or right after updating, otherwise every PDF generation fails with "unable to read file: helvetica.json". tecnickcom/tc-lib-pdf-font does not ship its fonts, and Composer deletes built fonts on every update of that package. Either
- build them inside vendor/ with
php vendor/tecnickcom/tc-lib-pdf-font/util/build_fonts.php, preferably aspost-install-cmdandpost-update-cmdscripts in the project's composer.json, or - build them into a directory outside of vendor/ and set
$settings['tcpdf_fonts_path']in settings.php.
The README has the exact commands. The status report shows whether TCPDF finds the fonts.
- build them inside vendor/ with
- Output: TCPDF 7 output is close to TCPDF 6 but not identical; line breaks and font metrics can differ slightly. Check documents with a fixed layout.
- Local files: TCPDF 7 only reads local files, such as images, from trusted directories (system temporary directory, the Drupal root, library directories). Add other directories, for example for private files, with
define('K_ALLOWED_PATHS', [...])in settings.php. - <tcpdf> tags: calling TCPDF methods from HTML is disabled by default now. Sites that use it define
K_TCPDF_CALLS_IN_HTMLandK_ALLOWED_TCPDF_TAGSin settings.php. - Custom TCPDF constants: tcpdf.config.inc now only defines
K_PATH_FONTSandPDF_IMAGE_SCALE_RATIO; all other constants take TCPDF's defaults, which have the same values as before. Constants defined in settings.php still take precedence.
Requirements
Changed:
- Drupal core
^11.3 || ^12(was^10.6 || ^11.3 || ^12). Drupal 10 is no longer supported; Drupal 10 sites stay on 2.1.x. - tecnickcom/tcpdf
^7.0.15(was^6.11.4), which needs PHP 8.2 or later, covered by Drupal 11.
Contributors (1)
Changelog
Issues: 1 issue resolved.
Changes since 2.1.0:
Feature
- #3603622 Support TCPDF 7 (tc-lib-pdf):
- Require tecnickcom/tcpdf
^7.0.15, composer-runtime-api^2.1and Drupal^11.3 || ^12. - Add the setting
$settings['tcpdf_fonts_path']and a status report entry for the TCPDF fonts. - Reduce tcpdf.config.inc to the constants that differ from TCPDF's defaults;
<tcpdf>tags in HTML are disabled by default. - Remove the TCPDF cache directory
temporary://tcpdf/cacheand its status report entry, which TCPDF 7 no longer uses.
- Require tecnickcom/tcpdf