Save as PDFs on Web
It’s not uncommon for customers to want a setup where a document is read-only but users can still edit it and then use the Save As functionality to save the modified document to a new location. PSPDFKit supports saving documents with the Save As functionality.
To use the Save As functionality:
-
Set the autosave mode to
DISABLED
so the changes in the loaded PSPDFKit for Web instance aren’t persisted on the backend.
You can do this by passing PSPDFKit.AutoSaveMode.DISABLED
to the autoSaveMode
property in the configuration object passed to PSPDFKit.load()
:
PSPDFKit.load({ autoSaveMode: PSPDFKit.AutoSaveMode.DISABLED });
-
Create a custom Save As button in the toolbar that lets the user export the document in its current state to a new location. For the implementation, refer to our guide on how to create a new tool in our viewer.
-
The Save As button handler exports the PDF and sends it to your remote server. Refer to our guide on saving PDFs to a remote server using JavaScript for more information.
-
If you’re using Document Engine, you can upload the PDF to Document Engine via its upload API to create a new file. Refer to our guide on uploading a document for more information.
-
If you’re using PSPDFKit for Web Standalone, your backend now should persist the PDF in its storage.