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.
How to Render Linearize PDFs
- Download IronPDF C# Library from NuGet
- Instantiate the PDF renderer and pass the HTML string
- Render the HTML string with
RenderHtmlAsPdf
- Save PDF as a linearize PDF with
SaveAsLinearized
- Verify whether the PDF is linearized with
IsLinearized
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
Output

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
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
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
Output

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