How to Linearize PDFs

A linearized PDF, also known as a "Fast Web View" or "web-optimized PDF," is structurally reorganized for internet streaming. This allows a compatible viewer to display the first page of a document almost instantly, well before the entire file has finished downloading.  

In mission-critical or time-sensitive applications, this feature is especially useful. It eliminates frustrating load times for large documents, particularly on slow or mobile networks, allowing users to interact with content immediately. This facilitates quicker decision-making and boosts productivity in professional environments.  

In this how-to article, we'll explore the options that IronPDF offers developers to export their documents as linearized PDFs.

Get started with IronPDF

Start using IronPDF in your project today with a free trial.

First Step:
green arrow pointer



Save As Linearize PDF

Saving a document as a linearized PDF with IronPDF is a quick and easy process. In this example, we'll render an HTML string to a PDF using RenderHtmlAsPdf. Afterwards, we'll save the PdfDocument object as a linearized PDF using the SaveAsLinearized instance method. This method takes a string argument for the output file path.

:path=/static-assets/pdf/content-code-examples/how-to/linearize-pdf.cs
using IronPdf;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Pdf Bytes</h1>");

// Get the PDF binary data
var pdfBytes = pdf.BinaryData;

// Save the PDF binary data as a linearized PDF file
PdfDocument.SaveAsLinearized(pdfBytes, "linearize-from-bytes.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output

Fast Web View PDF

Save As Linearize PDF bytes

In addition to saving a PdfDocument object directly, IronPDF also allows users to convert a PDF byte array into a linearized PDF. In this example, we'll demonstrate rendering an HTML string into a PdfDocument object, obtaining its byte array, and then saving that data as a linearized PDF. This SaveAsLinearized method also accepts an optional third string parameter for a password if the source document is encrypted.

:path=/static-assets/pdf/content-code-examples/how-to/linearize-pdf-bytes.cs
using IronPdf;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Pdf Bytes</h1>");

// Get the PDF binary data
var pdfBytes = pdf.BinaryData;

// Save the PDF binary data as a linearized PDF file
PdfDocument.SaveAsLinearized(pdfBytes, "linearize-from-bytes.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output

This is the file that the code produced:

Save As Linearize PDF MemoryStream

The SaveAsLinearized method can also accept Stream objects as input. In this example, we'll convert a PdfDocument object into a byte array, write it to a MemoryStream, and then save the stream as a linearized PDF to demonstrate this capability.

:path=/static-assets/pdf/content-code-examples/how-to/linearize-pdf-stream.cs
using IronPdf;
using System.IO;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Memory Stream</h1>");

// Get the PDF binary data
var pdfBytes = pdf.BinaryData;

// Transform PDF bytes to a MemoryStream
MemoryStream memoryStream = new MemoryStream(pdfBytes);

// Save the MemoryStream as a linearized PDF
PdfDocument.SaveAsLinearized(memoryStream, "linearize-stream.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

This is the file that the code produced:


Verify Whether a PDF is Linearized

Besides checking the document properties in a PDF viewer, such as Adobe Acrobat, to see if a PDF is linearized, IronPDF also provides a way to check this programmatically with the IsLinearized method. The method takes a string parameter for the file path and an optional second string parameter for the password if the PDF is encrypted.

In this example, we'll use the output files from the three examples above to test whether they are linearized, and include a fourth, non-linearized PDF to showcase the method's behavior.

:path=/static-assets/pdf/content-code-examples/how-to/linearize-pdf-test.cs
using IronPdf;
using System;

// First example Linearized PDF
Console.WriteLine(PdfDocument.IsLinearized("linearize.pdf"));

// Second example Linearized PDF
Console.WriteLine(PdfDocument.IsLinearized("linearize-from-bytes.pdf"));

// Third example Linearized PDF
Console.WriteLine(PdfDocument.IsLinearized("linearize-stream.pdf"));

// Fourth example Non-Linearized PDF
Console.WriteLine(PdfDocument.IsLinearized("sample.pdf"));
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output

Is Linearized Results

As you can see, the first three examples return true, while the last PDF, which is not linearized, returns false.

Please noteThere is no method to check if a PdfDocument object itself is linearized. This is because when a PDF file is opened and loaded into an object, its special linearized structure is lost. For the same reason, there is no method to return a linearized PDF as a byte array. This linearized feature only exists as a saved file on disk.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...Read More

Ready to Get Started?
Nuget Downloads 15,599,605 | Version: 2025.10 just released