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 | ||
Only requires HTTPS server | ||
Read-write while downloading | ||
Only downloads the required data | ||
Any PDF supported without preparation |
Enable linearized downloading
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.
-
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.
-
Upload the linearized PDF to your HTTPS server.
-
Add the
allowLinearizedLoading: true
option inPSPDFKit.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.