Fast Web View (Linearized Pdf) | |
SelectPdf Library for .NET can save a PDF document linearized, also called "Fast Web View": its objects are ordered first page first, and hint tables say where every page is, so a viewer reading the document over the web shows the first page before the rest has arrived and fetches any other page on its own. This helps large documents served from a web site.
Set Linearize to true before saving. It applies to a document built from code, to the result of an html or Word conversion and to a loaded document.
// a converted page HtmlToPdf converter = new HtmlToPdf(); PdfDocument doc = converter.ConvertUrl("https://selectpdf.com"); doc.Linearize = true; doc.Save("web.pdf"); doc.Close(); // an existing document PdfDocument report = new PdfDocument("big-report.pdf"); report.Linearize = true; report.Save("big-report-web.pdf"); report.Close();
An encrypted document stays encrypted, with the same passwords and permissions.
PDF/A (from PDF/A-2 on) and PDF/UA documents keep their conformance; the logical structure of a tagged document is kept.
A signed document is not linearized: a rewrite would break its signatures, so the save throws a PdfDocumentException instead. Linearize, then sign. Signing a linearized file later appends a revision to it, which keeps the signature valid but leaves the file no longer linearized, as in Adobe Acrobat.
A linearized file helps viewers that read it while it downloads, such as Google Chrome, Microsoft Edge and Adobe Acrobat. For a file opened from a disk, linearizing changes nothing.