DsPdfViewer allows you to save the modified PDF document using Save button () on the Main Toolbar, Annotation Editor Toolbar, and Form Editor Toolbar.
You can also save the PDF document by using save method programmatically. This method saves the PDF document to the local disk in its existing state.
JS |
Copy Code
|
---|---|
// Save the PDF document. viewer.open("/assets/realestate-lease.pdf").then( res => { viewer.save("Export.pdf"); } ); |
DsPdfViewer allows you to save PDF documents in different formats using Save as drop-down menu () on the Main Toolbar, Annotation Editor Toolbar, and Form Editor Toolbar. Save As drop-down menu provides Save as PNG images and Save as SVG images options to export the PDF as a set of PNG and SVG images and download the resultant zip archive on the client machine.
You can also save the PDF document using save method, which accepts format option and the name of the output zip archive as parameters and downloads the current PDF document as PNG or SVG images in zip format.
JS |
Copy Code
|
---|---|
// Save the PDF document as SVG images. viewer.open("/assets/realestate-lease.pdf").then( res => { viewer.save("ExportSVG.zip", { format: "SVG" }); } ); // Save the PDF document as PNG images. viewer.open("/assets/realestate-lease.pdf").then( res => { viewer.save("ExportPNG.zip", { format: "PNG" }); } ); |
DsPdfViewer also allows you to customize the behavior and enable or disable the Save as drop-down menu using saveAsOptions option. saveAsOptions option comprises availableFormats and showSaveAsButton options. availableFormats option allows a user to customize the options in the drop-down menu, whereas showSaveAsButton option allows a user to show or hide the Save as drop-down menu. Refer to the following example codes for different customizations:
JS |
Copy Code
|
---|---|
// Hide Save As drop-down menu. var viewer = new DsPdfViewer("#host", { supportApi: 'api/pdf-viewer', saveAsOptions: { showSaveAsButton: false } }); |
JS |
Copy Code
|
---|---|
// Restrict Save As options to PDF and PNG. var viewer = new DsPdfViewer("#host", { supportApi: 'api/pdf-viewer', saveAsOptions: { availableFormats: ["PDF", "PNG"] } }); |