๐ Linearized (Fast Web View)
Optimized PDFs that display the first page immediately while the rest downloads in the background.
C# โ Linearized PDF
var doc = new PdfDocument();
// Enable linearization (Fast Web View)
// Reorders internal objects so the first page
// can render before the full file downloads.
// Ideal for PDFs served over HTTP.
doc.Linearize = true;
// Build the document as usual...
doc.Info.Title = "Linearized PDF";
doc.Language = "en-US";
doc.DisplayDocTitle = true;
var root = doc.EnableTaggedPdf();
// Add multiple pages
for (int i = 1; i <= 5; i++)
{
var sect = root.AddChild(StructureType.Sect);
var h1 = sect.AddChild(StructureType.H1);
var p = sect.AddChild(StructureType.P);
var page = doc.AddPage();
page.AddTaggedText(h1, $"Page {i}", 72, 720,
new PdfTextOptions {
Font = StandardFont.HelveticaBold,
FontSize = 20
});
page.AddTaggedText(p,
"Linearized PDFs display this page " +
"instantly while the rest downloads.",
72, 690);
page.AddArtifactText($"Page {i} of 5",
270, 30, PdfArtifactType.Pagination);
}
doc.Save("linearized.pdf");
You should see three pages each with a bold "Page N" heading and a paragraph explaining linearized fast web view. In Adobe Acrobat or a browser PDF viewer, open Document Properties โ Description and confirm "Fast Web View: Yes". The visible content is identical to a non-linearized PDF โ only the internal byte layout differs.
File: 19_linearized.pdf
When to Use Linearization
| Scenario | Recommended |
|---|---|
| PDF served from a web server | โ Yes โ users see page 1 immediately |
| PDF downloaded then opened | โช Optional โ no visible benefit |
| PDF embedded in an <iframe> | โ Yes โ improves perceived performance |
| Single-page PDF | โช No benefit โ only one page to load |