Save documents as PDFs on the web
Use the Save As workflow when users need to edit a read-only document and save the result as a new file.
To create this workflow, combine disabled autosave with a custom toolbar button.
Configure Save As
Follow these steps to configure Save As in Nutrient Web SDK.
- Set
autoSaveModetoDISABLED, so the loaded Nutrient Web SDK instance doesn’t persist changes on the backend. - Add a custom Save As button to the toolbar.
- Export the PDF.
- Send the exported PDF to your storage backend.
Pass NutrientViewer.AutoSaveMode.DISABLED to autoSaveMode in the configuration object:
NutrientViewer.load({ autoSaveMode: NutrientViewer.AutoSaveMode.DISABLED}).catch((error) => { console.error("Failed to load document:", error.message);});Create a custom Save As button in the toolbar. This button exports the document and sends it to a new location. For implementation details, refer to the create a new tool in the viewer guide.
A Save As workflow that leaves the source document untouched is available in standalone deployments only. In a server-backed deployment, instance.exportPDF() fetches the document from Document Engine, so the export reflects what Document Engine has stored. Calling instance.save() first adds the pending annotations to the export, but it also writes them to the source document. Printing has the same effect. With Document Engine 1.17.0 or later, the default NutrientViewer.PrintMode.DOM saves pending annotations to the source document before it renders. Excluding annotations from the print call avoids that save.
The Save As button handler exports the PDF and sends it to your remote server. For more information, refer to the save PDFs to a remote server using JavaScript guide.
If you use Document Engine, upload the PDF with its upload API to create a new file. For more information, refer to the upload a document guide.
If you use Nutrient Web SDK without Document Engine, your backend persists the PDF in its storage.