Table of contents
Composer is how tc-lib-pdf is normally installed. This page covers the other side: working on the library itself, and building the RPM and DEB packages that some deployment models need. No prebuilt RPM or DEB packages are published.
Development Workflow
Use the project Makefile as the main entry point for local development tasks:
# Install all development dependencies
make deps
# List all available Make targets
make help
# Run the full quality pipeline (dependency checks, formatting, lint, static analysis, tests)
make qa
# Run the same checks and produce the coverage report
make qa-coverage
# Run the unit tests under an LC_CTYPE test locale (requires localedef)
make test-locale
# Generate one sample per conformance mode and run the external validators (if installed)
make preflight
Build artifacts and reports are written to target/.
make test-locale builds a test locale under target/locale/ with localedef and runs the unit tests with LC_CTYPE set to it. The pattern matching on byte strings does not depend on LC_CTYPE, and these tests check it. The target is skipped when localedef is not available or cannot build the locale.
Preflight Matrix
make preflight builds one sample PDF for every PDF/A, PDF/X and PDF/UA mode, each carrying the metadata its mode requires, and fails if generating a sample raises a warning. It then runs whatever validators are on the machine:
qpdf --checkfor the structural check.verapdfagainst the matching PDF/A flavour (1a,1b,2a,2b,2u,3a,3b,3u) and PDF/UA flavour (ua1,ua2).- The command in
PDFX_VALIDATOR_CMD, when set, for the PDF/X samples.
veraPDF has no PDF/X profile, so PDF/X samples get the structural check and that optional hook only. Reports land under target/preflight/report/.
A passing matrix is not a compliance claim: that needs profile-specific preflight policies and review by your own validation authority.
Packaging
Composer is the default distribution channel. For system-level deployments, RPM and DEB packages can be built from a clone of the repository; none are published:
make rpm # build RPM package -> target/RPM/
make deb # build DEB package -> target/DEB/
When using the RPM or DEB package, bootstrap the library with its system autoloader:
require_once '/usr/share/php/Com/Tecnick/Pdf/autoload.php';
When To Use These Targets
- Use
make depswhen working on the library itself rather than consuming it as a dependency. - Use
make qabefore opening pull requests or validating larger refactors, andmake qa-coveragewhen you also need the coverage report. - Use
make preflightwhen you need external standards validation of the PDF/A, PDF/X and PDF/UA output. - Use
make rpmormake debonly when your deployment model relies on system packages instead of Composer installs.
Security Configuration Note
tc-lib-pdf restricts both remote and local resource loading.
- Remote HTTP/HTTPS fetches are disabled unless you set
fileOptions.allowedHosts. - Local file reads for internal library IO are controlled by
fileOptions.allowedPaths, and reads triggered by rendered HTML, CSS, or SVG markup byfileOptions.markupAllowedPaths. - Supplying either key replaces the computed defaults, so include every required local asset directory. The bundled sRGB profile and the tc-lib-pdf-font package fonts are read through separate file helpers limited to those files, and need no entry.
- Rendering time grows with the size of the HTML, CSS, and SVG input and with the number of pages it produces, so bound the size of untrusted input and the run time of the rendering workers.
For the full fileOptions reference and examples, see the remote resources guide below.
Related Guides
- Font generation and custom font import: /docs/fonts/
- Remote asset allowlisting and transport controls: /docs/remote-resources/
- Standards and conformance modes: /docs/standards/
Previous: /docs/fonts/
Overview: /docs/
Next: /docs/enums/