Enhance PDF performance with linearized downloading

Linearized PDFs allow viewing a PDF while it’s still downloading, enabling faster access to information in the PDF. This is especially useful for large documents where quick access is critical.

Document Engine with streaming offers even more advantages, but sometimes linearized downloading is the best option.

Comparison

Document Engine streaming Linearized downloading
Fast initial page rendering green check icon green check icon
Only requires HTTPS server grey cross icon green check icon
Read-write while downloading green check icon grey cross icon
Only downloads the required data green check icon grey cross icon
Any PDF supported without preparation green check icon grey cross icon

Enable linearized downloading

Information

PDFs are read-only until fully downloaded. This means that while you can see the information in a PDF, you cannot, for example, add an annotation until the PDF is fully downloaded.

  1. Prepare your PDF for linearization: This can be done using Nutrient’s Document Engine or .NET SDK. If you’re using other third-party tools, PDF linearization might be called fast web loading.

  2. Upload the linearized PDF to your HTTPS server.

  3. Add the allowLinearizedLoading: true option in PSPDFKit.load:

PSPDFKit.load({
  container: "#container",
  document: "https://example.com/path/to/linearized.pdf",
  allowLinearizedLoading: true,
});

Check server support

Use curl to check if your server accepts range requests:

curl -I https://example.com/path/to/linearized.pdf -H "Range: bytes=0-1"

If the server supports range requests, you’ll see a 206 Partial Content response and an Accept-Ranges: bytes header.

Additional information

  • This is strictly a feature to speed up viewing a PDF while downloading. It won’t allow you to modify the PDF until it’s fully downloaded.

  • Linearized downloading only has an effect when a PDF is downloaded from an external web server.