enableLinearization(); $template->apply($doc); $doc->addPage(); $template->masthead($doc); $template->registerFaces($doc, [['Inter', 'B'], ['JetBrainsMono', '']]); // emphasis + .np-mono spans $body = <<<'HTML'

Executive summary

This report ships as a linearized PDF — also called Fast Web View in desktop readers. A linearized file places a small linearization parameter dictionary as its very first object, followed by everything a viewer needs to paint page one, so a browser or reader can begin displaying content while the rest of the file is still arriving over the network. For a short brief like this one the difference is barely perceptible; for the multi-hundred-page manuals, statements, and archival bundles NextPDF renders in production, it is the difference between an instant first page and a multi-second blank-screen wait.

How Fast Web View streaming works

ISO 32000-2 Annex F defines the linearized file structure precisely so that any conforming reader can exploit it, without vendor-specific tricks:

Time to first page by connection profile

Measured against a representative 220-page NextPDF statement bundle, serving over HTTP byte-range requests instead of waiting for the complete download:

Connection profile Without linearization With Fast Web View Improvement
Fiber / office LAN 340 ms 85 ms 4.0× faster
Home broadband 1.1 s 190 ms 5.8× faster
4G mobile 2.6 s 340 ms 7.6× faster
Congested public Wi-Fi 6.4 s 510 ms 12.5× faster

Figures are illustrative reference measurements for a 220-page bundle; actual gains scale with document size and shrink toward zero on very short documents like this sample.

When to enable it

Turn linearization on for anything a person opens directly in a browser tab or a desktop reader over a network link — statements, contracts, manuals, and reports delivered by URL rather than as an email attachment already on disk. It costs a small amount of extra writer time and a marginally larger file (the hint stream and duplicated first-page cross-reference entries add a few hundred bytes to a few kilobytes), which is a good trade for documents users expect to open instantly. The engine keeps this configuration mutually exclusive with encryption and in-process signing. The release pipeline signs the completed linearized base as an ISO 32000-2 ยง12.8 incremental update: /L continues to identify the first revision while the signature chain extends the published file. Skip linearization for documents that are always fully downloaded before opening, such as files delivered over internal batch transfer or archived directly to disk.

Reader & delivery compatibility

Linearization is a hint, not a requirement — every reader can still open a linearized file the ordinary way, and only readers plus delivery paths that support HTTP byte-range requests actually see the fast first page:

Delivery path Range-request support First-page benefit
Browser built-in viewer (Chrome, Edge, Firefox) Native Immediate
Adobe Acrobat / Reader opening a URL Native Immediate
Object storage or CDN in front of the file (R2, S3, Fastly, Cloudflare) Passthrough Immediate
Legacy proxy or gateway that buffers the full response None None — behaves like an unlinearized file
Email attachment or a copy already on local disk Not applicable None needed — the file is already fully present

Verifying a linearized file

Two independent signals confirm linearization took effect: a structural check that the file's first object is a valid /Linearized dictionary whose /L value matches the unsigned file length, or the first revision through its terminal %%EOF once the release signature is appended; and a visual check in any PDF reader that supports progressive rendering. NextPDF's release pipeline runs both checks, plus a third-party qpdf --check pass, before publication.

Bottom line

Fast Web View changes byte layout, not appearance: the rendered page is pixel-identical to an unlinearized file, and every viewer path in the compatibility table above still opens it correctly. In NextPDF the whole optimization is one call — $doc->enableLinearization(); before $doc->save();. Keep encryption and in-process signature configuration off that render; when release signing is required, append the PAdES chain after the linearized base is complete. For any report, statement, or manual served by URL to a browser or a network-attached reader, that one line is worth calling on every render.

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