# Save PDF Document

DsPdf is a Document Solutions product that offers a rich library to read, create, modify, and save PDF files without using any external tool.

## Content

DsPdfViewer allows you to save the modified PDF document using **Save** button (![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/save-button.png)) on the Main Toolbar, Annotation Editor Toolbar, and Form Editor Toolbar.
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/save-pdf.gif)
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.

```javascript
// Save the PDF document.
viewer.open("/assets/realestate-lease.pdf").then(
    res => {
        viewer.save("Export.pdf");
    } 
);
```

## Save PDF in Alternative Formats

DsPdfViewer allows you to save PDF documents in different formats using **Save as** drop-down menu (![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/save-as-button.png)) 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.
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/save-as-pdf.gif)

> !type=note
> **Note:** The key for Save as drop-down menu is **save-as**, which can be used to customize the toolbar.

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.

```javascript
// 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" });
    } 
);
```

## Customize Save as Drop-Down Menu

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:

### Example 1: Hide "Save As" Drop-Down Menu

```javascript
// Hide Save As drop-down menu.
var viewer = new DsPdfViewer("#host", { supportApi: 'api/pdf-viewer', saveAsOptions: { showSaveAsButton: false } });
```

### Example 2: Restrict "Save As" Formats

```javascript
// Restrict Save As options to PDF and PNG.
var viewer = new DsPdfViewer("#host", { supportApi: 'api/pdf-viewer', saveAsOptions: { availableFormats: ["PDF", "PNG"] } });
```