Skip to content

Examples

Dragon edited this page Jun 4, 2026 · 3 revisions

Examples

Runnable, end-to-end scripts that combine several phppdf subsystems into a realistic document. Each script lives next to its generated PDF in the examples/ directory of the repository.

The examples are kept out of the Composer package (composer require does not download them). To run them, clone the repository.

Running

git clone https://github.com/dragonofmercy/php-pdf.git
cd php-pdf
composer install
php examples/example-invoice.php   # writes examples/example-invoice.pdf next to the script

Catalogue

The PDF link opens the rendered result directly in GitHub's viewer, so you can see what each script produces before running it.

Example PDF Scenario Subsystems shown
example-invoice.php view PDF Commercial invoice Metadata, margins, header/footer with page numbers, table (fixed + fill columns, zebra), totals via cells
example-report.php view PDF Multi-page report Flowing Markdown with automatic page breaks, header/footer, bookmarks
example-labels.php view PDF Shipping labels Custom page dimensions, Code 128 + QR barcodes, tight text layout
example-catalog.php view PDF Product catalogue Card grid of cells, embedded raster image reused across cards, clickable links
example-svg-poster.php view PDF Vector poster Full-page inline SVG: gradients, shapes, selectable text
example-financials.php view PDF Quarterly financials Table cell spanning: grouped headers (H1 / H2 band over quarter columns, rising "Item" header) and full-width section banners via colSpan

See also

Clone this wiki locally