Temporary storage for PDF downloads
When you load a PDF from a URL in the browser, Nutrient Web SDK has to keep the downloaded PDF somewhere so it can continue reading from it while the user works with the document.
By default, Web SDK manages this automatically. For larger eligible PDFs, it uses the browser’s origin private file system (OPFS)(opens in a new tab) to reduce peak browser RAM usage.
When temporary storage is used
This behavior applies when you load a PDF from a URL in the browser:
NutrientViewer.load({ container: "#pspdfkit", document: "https://www.nutrient.io/downloads/nutrient-web-demo.pdf"});It doesn’t apply in the same way when you pass document data directly as an ArrayBuffer or Blob, because your application is already providing the document data to the viewer.
Why Web SDK uses OPFS
If you download a PDF from the internet, the viewer needs to keep that PDF somewhere so it can continue reading from it while the user works with the document.
Without OPFS, the downloaded PDF data has to stay in browser process memory (RAM). For larger PDFs, this can noticeably raise peak RAM usage.
With origin private file system (OPFS)(opens in a new tab), Web SDK can keep temporary download data in secure browser-managed storage on the user’s device instead of keeping all of it in browser process memory (RAM). OPFS is supported by all major browsers.
This enables Web SDK to reduce browser RAM pressure for larger eligible URL-loaded PDFs while keeping the default behavior automatic with tempStorage, which is set to "auto".
Configuring temporary storage
Use the tempStorage option to control this behavior.
Default behavior
"auto" is the default. Web SDK decides when to use OPFS for larger eligible URL-loaded PDFs:
NutrientViewer.load({ container: "#pspdfkit", document: "https://www.nutrient.io/downloads/nutrient-web-demo.pdf", tempStorage: "auto"});Disable OPFS-backed temporary storage
If you don’t want Web SDK to use OPFS for temporary storage, set tempStorage to "memory":
NutrientViewer.load({ container: "#pspdfkit", document: "https://www.nutrient.io/downloads/nutrient-web-demo.pdf", tempStorage: "memory"});This keeps temporary download data in the browser process memory (RAM).
Prefer OPFS
If you want to prefer OPFS for eligible URL-loaded PDFs regardless of file size, set tempStorage to "opfs":
NutrientViewer.load({ container: "#pspdfkit", document: "https://www.nutrient.io/downloads/nutrient-web-demo.pdf", tempStorage: "opfs"});Fallback behavior
If OPFS is unavailable or initialization fails, Web SDK falls back to the in-memory (browser RAM) path automatically.
In that case, the document may be requested again.