Examples

All 85 runnable tc-lib-pdf examples, grouped by topic, each with its rendered PDF and its PHP source

Every example below is a standalone PHP script from the tc-lib-pdf repository, shipped with the PDF it produces. Each page embeds both, and links to the raw .pdf and the .phps source so they can be downloaded or read directly.

The scripts live in examples/ in the repository and run in place, because local file reads are restricted to an allowlist covering the package tree. Fonts must be generated first: see /docs/fonts/.

Start Here

  • E006 minimal : the shortest script that produces a PDF, from font insertion to output.
  • E076 absolute position : placing content at explicit coordinates alongside flowed content.
  • E049 output targets integration : streaming to the browser, saving to a file, attaching to a message, all from the same raw bytes.
  • E000 overview : a visual showcase of barcodes, QR codes, SVG, images, transparency, and gradients on a few pages.

Pages and Layout

Text and Typography

Multilingual Text

Fonts

Full guide: /docs/fonts/.

HTML and CSS

Full guide: /docs/html-css/.

Vector Graphics

Colour

Images

Barcodes

The 73 formats are listed on /projects/tc-lib-barcode/.

Interactive Documents

Standards and Conformance

  • E001 invoice : a Factur-X 1.07 and ZUGFeRD 2.3 hybrid invoice embedded in PDF/A-3.
  • E010 pdfx : the PDF/X conformance mode and what it changes in the output.
  • E011 pdfx1a : PDF/X-1a, with forced CMYK and no transparency.
  • E012 pdfx3 : PDF/X-3, which allows device-independent colour with an output intent.
  • E013 pdfx4 : PDF/X-4, which allows live transparency and optional content.
  • E014 pdfx5 : PDF/X-5, with external graphical content references.
  • E015 pdfua : PDF/UA output auto-tagged from HTML.
  • E016 pdfua1 : PDF/UA-1 (ISO 14289-1) auto-tagged from HTML.
  • E017 pdfua2 : PDF/UA-2 (ISO 14289-2, PDF 2.0) auto-tagged from HTML.
  • E063 manual tag tree : building the structure element tree by hand instead of from markup.
  • E060 custom xmp metadata : custom XMP fragments at the five insertion points.
  • E082 pdfa core fonts : PDF/A core font substitutes, glyph names, and WinAnsiEncoding.

Full guide: /docs/standards/.

Encryption and Permissions

Digital Signatures

Full guide: /docs/digital-signatures/.

Importing Existing PDFs

Full guide: /docs/pdf-import/.

Remote and Local Resources

Full guide: /docs/remote-resources/.