apply($doc); $doc->addPage(); $template->masthead($doc); $template->registerFaces($doc, [['Inter', 'B']]); // /bold KPI values + insight highlights $leftX = SampleTemplate::mm(SampleTemplate::MARGIN_LEFT_MM); $rightX = $doc->getPageWidth() - SampleTemplate::mm(SampleTemplate::MARGIN_RIGHT_MM); $bodyWidth = $rightX - $leftX; // Preserve the sample's compact typography and mark proportions through the // theme token model. Tailwind is the closest built-in chrome to the site's // approved ink, muted-text, and hairline colours. $baseTheme = BuiltinTheme::Tailwind->theme(); $baseMarks = $baseTheme->marks(); $chartTheme = $baseTheme ->withName('nextpdf-sample') ->withTypography(new TypographyTokens( titleSize: 7.5, subtitleSize: 7.5, axisTitleSize: 7.5, tickSize: 7.5, legendSize: 7.5, dataLabelSize: 7.5, )) ->withMarks(new MarkTokens( barGapRatio: 0.35, groupGapPt: $baseMarks->groupGapPt, segmentGapPt: $baseMarks->segmentGapPt, lineWidthPt: 1.5, dotRadiusPt: 2.5, dotRingPt: $baseMarks->dotRingPt, strokeWidthPt: $baseMarks->strokeWidthPt, )); // Series identity stays on the approved print palette while non-categorical // roles and ramps retain the Tailwind preset's complete palette vocabulary. $basePalette = BuiltinPalette::Tailwind->palette(); $chartPalette = new ChartPalette( name: 'nextpdf-sample', categorical: [ ChartColor::hex(PrintPalette::PRISM_900), ChartColor::hex(PrintPalette::CHIP_PRO), ChartColor::hex(PrintPalette::CHIP_ENTERPRISE), ], other: $basePalette->other, positive: $basePalette->positive, negative: $basePalette->negative, neutral: $basePalette->neutral, sequential: $basePalette->sequential, diverging: $basePalette->diverging, surfaceAffinity: $basePalette->surfaceAffinity, ); // Shared sample-specific CSS (in addition to SampleTemplate::sharedCss()). // Re-declared on every writeHtml() call below: each call parses an // independent HTML fragment, so CSS; // ── Page 1: KPI row + render volume by document profile ────────────── $kpiRow = <<Q2 2026 rendering telemetry

Live engine metrics across every document profile, drawn directly through the Pro chart API — no external charting library.

4.2M

DOCUMENTS RENDERED

99.98%

SUCCESS RATE

52 ms

MEDIAN LATENCY

3

EDITIONS IN PRODUCTION

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $kpiRow); $barIntro = <<Render volume by document profile

Documents rendered per profile this quarter, aggregated from production render telemetry (thousands).

HTML; $doc->setY($doc->getY() + 6.0); $doc->writeHtml(SampleTemplate::sharedCss() . $css . $barIntro); $barBoxY = $doc->getY() + 8.0; $barBoxHeight = 330.0; $doc->setFont('Inter', '', 8.0); // chart labels paint in the caller's CURRENT font BarChart::fromData( ['Invoices', 'Reports', 'Labels', 'Archival'], // Preserve the 4.2M KPI while anchoring the chart at a clean 2M maximum. [2_000_000, 900_000, 700_000, 600_000], ) ->withTheme($chartTheme) ->withPalette($chartPalette) ->renderTo($doc, new ChartBox($leftX, $barBoxY, $bodyWidth, $barBoxHeight)); $doc->setY($barBoxY + $barBoxHeight + 14.0); $doc->writeHtml(SampleTemplate::sharedCss() . $css . '

Figures are illustrative sample data. All four profiles cleared 99.9%+ render success this quarter.

'); // ── Page 2: latency trend + edition mix ─────────────────────────────── $doc->addPage(); $lineIntro = <<Latency trend, this quarter vs. last

Median render latency by week, current quarter compared with the prior quarter (milliseconds).

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $lineIntro); $lineBoxY = $doc->getY() + 6.0; $lineBoxHeight = 175.0; $doc->setFont('Inter', '', 8.0); LineChart::create(['Wk1', 'Wk2', 'Wk3', 'Wk4', 'Wk5', 'Wk6', 'Wk7', 'Wk8']) ->addSeries('This quarter', [64, 62, 60, 59, 57, 55, 53, 52]) ->addSeries('Last quarter', [72, 71, 70, 69, 68, 66, 65, 63]) ->withTheme($chartTheme) ->withPalette($chartPalette) ->withDots(true) ->renderTo($doc, new ChartBox($leftX, $lineBoxY, $bodyWidth, $lineBoxHeight)); $doc->setY($lineBoxY + $lineBoxHeight + 20.0); $pieWidth = 340.0; $pieHeight = 190.0; $pieX = $leftX + ($bodyWidth - $pieWidth) / 2; $pieIntro = <<Edition mix by rendered volume

Share of this quarter's rendered documents by NextPDF edition.

HTML; $doc->writeHtml(SampleTemplate::sharedCss() . $css . $pieIntro); $pieBoxY = $doc->getY() + 4.0; $doc->setFont('Inter', '', 7.5); PieChart::fromData(['Core', 'Pro', 'Enterprise'], [58, 27, 15]) ->withTheme($chartTheme) ->withPalette($chartPalette) ->withPercentages(true) ->withLegend(true) ->renderTo($doc, new ChartBox($pieX, $pieBoxY, $pieWidth, $pieHeight)); $doc->setY($pieBoxY + $pieHeight + 16.0); $insights = <<Key findings

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