This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/optimization/linearize.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. C# .NET PDF linearization: Optimize PDF for fast web view | Nutrient .NET SDK

Linearize a PDF when you want to optimize a PDF for Fast Web View mode. This means that the linearized PDF loads faster in a browser or other applications that stream the document from a remote server. The linearization process restructures a PDF document so that only the requested page is downloaded from the server, rather than the entire PDF. This is especially important with large documents that can take a long time to download. For more on what linearization is and how it differs from a standard PDF, see our linearized PDF blog post.

Download sample

To linearize a PDF document, follow these steps:

  1. Create a GdPicturePDF object.
  2. Load the source document by passing its path to the LoadFromFile method.
  3. Save the output in a linearized PDF document with the SaveToFile method. This method takes the following parameters:
    • FilePath — The path to the output PDF document.
    • PackDocument — Optional: A Boolean value that specifies whether to pack the PDF document. This reduces the file size but slows down the saving process.
    • Linearize — Set this parameter to true to linearize the output PDF document.

Register the SDK license before running SDK operations. For setup details, refer to the getting started with .NET SDK guide.

using GdPicture14;
LicenseManager license = new LicenseManager();
license.RegisterKEY("");
using GdPicturePDF gdPicturePDF = new GdPicturePDF();
// Load a PDF document to GdPicture.
gdPicturePDF.LoadFromFile(@"input.pdf");
// Save the loaded PDF document to a file.
gdPicturePDF.SaveToFile(@"output.pdf", true, true);
Used methods
Related topics