# SaveSettings

## Content

# Type Alias: SaveSettings

```ts
type SaveSettings = object;
```

Additional save settings.

## Properties

### format?

```ts
optional format: "PDF" | "PNG" | "SVG";
```

Destination document format.
PDF - the document will be saved in PDF format.
PNG - the document will be saved to PNG images.
SVG - the document will be saved to SVG images.

#### Default

```ts
PDF.
```

#### Examples

Save the document as SVG images
```javascript
await viewer.save("sample.zip", { format: "SVG" });
```

Save document pages as PNG images
```javascript
await viewer.save("sample.zip", { format: "SVG" });
```

***

### pages?

```ts
optional pages: string;
```

You can specify the index of the page(s) or pages range to save.
For a range of pages, use a hyphen. Separate page or pages range with a comma, e.g. "0, 1, 4-5, 8".
You can also change the page order: "1, 0, 2-8",
clone required pages: "0, 0, 3, 3, 3",
specify external pdf file as source: "0-3, [file:fileid_1]0-3, [file:fileid_1]5-7, [file:fileid_2]0-3" (see examples for details),
or rotate page(s): await viewer.save("test_part10.pdf", { reload: true, pages: "[angle:90]2-3" });

#### Examples

```javascript
// Save six pages with indices: 0, 1, 2, 3, 7, 9:
await viewer.save("test_part10.pdf", { reload: true, pages: "0-3, 7, 9" });
```

```javascript
// Rotate 90 degrees and save 2 pages with indices 2 and 3:
await viewer.save("test_part10.pdf", { reload: true, pages: "[angle:90]2-3" });
```

```javascript
// Invoke the system file picker dialog
// to select an external PDF file to merge.
// Then, merge first page from selected PDF document and
// download result PDF file to local system.
var fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = ".pdf";
fileInput.style.display = 'none';
fileInput.onchange = function () {
    if (fileInput.files && fileInput.files[0]) {
        var fileReader = new FileReader();
        fileReader.onload = function () {
            const fileId = "uniquefileid_" + new Date().getTime();
            viewer.storage.setItem(fileId, new Uint8Array(fileReader.result));
            // Merge first page from external PDF document
            // to the end of the active PDF document
            // and download result PDF file:
            await viewer.save("sample.pdf",
                { pages: `0-${viewer.pageCount - 1}, [file:${fileId}]0`  });
        };
        fileReader.readAsArrayBuffer(fileInput.files[0]);
    }
};
document.body.appendChild(fileInput);
fileInput.click();
```

***

### progressMessage?

```ts
optional progressMessage: string;
```

Custom progress message to be displayed during save.
```javascript
viewer.save("sample.pdf", { pages: "[angle:90]0,1-5", progressMessage: "Rotating first page..." }, reload: true);
```

***

### progressTitle?

```ts
optional progressTitle: string;
```

Custom progress title to be displayed during save.
```javascript
viewer.save("sample.pdf", { pages: "[angle:90]0,1-5", progressTitle: "Rotating" }, reload: true);
```

***

### reload?

```ts
optional reload: boolean;
```

Load the updated PDF document into the viewer without downloading it to the local system.

#### Example0

```javascript
// Save dodument and load saved document into the viewer:
await viewer.save("test_part10.pdf", { reload: true });
```

***

### saveMode?

```ts
optional saveMode: "Auto" | "Default" | "Linearized" | "IncrementalUpdate";
```

Defines the mode of saving a PDF.

#### Default

```ts
Auto the PDF is not linearized and the incremental update will be used only for signed PDF documents.
```

***

### sign?

```ts
optional sign: SignatureInfo;
```

Signature settings used to save document with signature.
If specified, the document will be saved with signature.

***

### zoomFactor?

```ts
optional zoomFactor: number;
```

Zoom factor to be used for rendering images when the target format is "PNG".
```javascript
viewer.save("sample.pdf", { format: "PNG", zoomFactor: 1.5 });
```
