apply($doc); $doc->addPage(); $template->masthead($doc); $template->registerFaces($doc, [['Inter', 'B'], ['JetBrainsMono', '']]); // Custom rules beyond sharedCss(). Every rule here states font-weight and // color explicitly (never relies on an inherited default) — verified by a // standalone diagnostic render: an element nested inside a that omits // font-weight inherits whatever weight the table's own layout pass last // touched (a real engine quirk), so table-cell content always carries its // own explicit weight. Direct classes/tags on / themselves (not // nested children) resolve correctly, matching table.np-table's own th/td // rules in sharedCss(). $css = <<<'CSS' CSS; // ── Chapter 1 — Engine & Edition Matrix (page 1) ─────────────────────── $doc->bookmark('1. Engine & Edition Matrix', level: 0); $chapter1 = <<<'HTML'

1. Engine & Edition Matrix

NextPDF ships as three editions built on one shared engine core. A document generated on Core keeps rendering correctly after an upgrade — editions add capability, they never change behavior.

Capability Core Pro Enterprise
HTML/CSS rendering & tables IncludedIncludedIncluded
Vector drawing & shapes IncludedIncludedIncluded
Digital signatures (PAdES B-B / B-T) IncludedIncludedIncluded
Interactive charts IncludedIncluded
Tagged, accessible output (PDF/UA) Included
PDF/A archival profiles Included
AES-256 encryption & permissions Included
Fast Web View (linearization) Included

Every edition renders the matrix above through the same Document API — upgrading changes what is available, never how you call it.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $chapter1); // ── Chapter 2 — Five-Minute Integration ───────────────────────────────── $doc->addPage(); $doc->bookmark('2. Five-Minute Integration', level: 0); $chapter2Intro = <<<'HTML'

2. Five-Minute Integration

Every NextPDF document follows the same three calls: create, write, save. The example below produces a complete, valid PDF file on a fresh PHP 8.4 installation.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $chapter2Intro); $doc->bookmark('2.1 Install', level: 1); $section21 = <<<'HTML'

2.1 Install

Add the engine to any Composer-managed project. No native PHP extensions are required for the Core feature set.

composer require nextpdf/core
HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section21); $doc->bookmark('2.2 Render Your First PDF', level: 1); $section22 = <<<'HTML'

2.2 Render Your First PDF

This script creates a page, writes HTML content, and saves a PDF — the same three calls scale from a single page to a 500-page report.

<?php
 
use NextPDF\Core\Document;
 
$doc = Document::createStandalone();
$doc->setTitle('Quarterly Report');
$doc->addPage();
$doc->writeHtml('<h1>Hello, NextPDF</h1>');
$doc->save('report.pdf');

The sample above calls Document::createStandalone(), addPage(), writeHtml(), and save().

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section22); // ── Chapter 3 — Conformance & Archival ────────────────────────────────── $doc->addPage(); $doc->bookmark('3. Conformance & Archival', level: 0); $chapter3Intro = <<<'HTML'

3. Conformance & Archival

Every NextPDF document is a conformant ISO 32000-2 (PDF 2.0) file by construction. The engine also supports the long-term-preservation and accessibility profiles regulated industries require.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $chapter3Intro); $doc->bookmark('3.1 Long-Term Archival', level: 1); $section31 = <<<'HTML'

3.1 Long-Term Archival

PDF/A output embeds every font and color profile the document needs, so an archived file renders identically decades after it was produced — without depending on external resources.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section31); $doc->bookmark('3.2 Accessibility', level: 1); $section32 = <<<'HTML'

3.2 Accessibility

Tagged output exposes headings, tables, and reading order to assistive technology, meeting the structural requirements of PDF/UA.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section32); $doc->bookmark('3.3 Digital Signatures', level: 1); $section33 = <<<'HTML'

3.3 Digital Signatures

PAdES signatures attach cryptographic proof of authorship and, at the B-T level, a timestamp that survives certificate expiry.

StandardScope
ISO 32000-2:2020Base document format (PDF 2.0)
ISO 19005 (PDF/A)Long-term archival fidelity
ISO 14289 (PDF/UA)Structured, accessible output
ETSI EN 319 142 (PAdES)Digital signature profiles B-B / B-T / B-LT

Every profile above builds on the same Document API from Chapter 2 — no separate SDK, extension, or configuration file to learn.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section33); // ── Chapter 4 — Operations ─────────────────────────────────────────────── $doc->addPage(); $doc->bookmark('4. Operations', level: 0); $chapter4Intro = <<<'HTML'

4. Operations

Each document instance is self-contained, so NextPDF renders concurrently across queue workers and serverless handlers without shared mutable state.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $chapter4Intro); $doc->bookmark('4.1 Deployment Pipeline', level: 1); $section41 = <<<'HTML'

4.1 Deployment Pipeline

A typical production pipeline composes the document, validates its structure, applies a digital signature, and delivers the finished file:

Compose → Validate → Sign → Deliver

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section41); $doc->bookmark('4.2 Monitoring & Support SLA', level: 1); $section42 = <<<'HTML'

4.2 Monitoring & Support SLA

Priority support plans include a 4-hour response SLA and direct engineering escalation for regulated production workloads.

Together, deterministic rendering, worker-safe isolation, and a monitored SLA are why regulated pipelines standardize on NextPDF for document delivery that cannot drift between runs.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $section42); $output = \getenv('NEXTPDF_SAMPLE_OUTPUT') ?: __DIR__ . '/../output/handbook.pdf'; $doc->save($output); echo "Created: {$output}\n";