# Type alias SaveSettings

SaveSettings: { format?: "PDF" | "PNG" | "SVG"; pages?: string; progressMessage?: string; progressTitle?: string; reload?: boolean; saveMode?: "Auto" | "Default" | "Linearized" | "IncrementalUpdate"; sign?: SignatureInfo; zoomFactor?: number }

Additional save settings.

#### Type declaration

- ##### `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

  PDF.

  ### Example

  Save the document as SVG images

      await viewer.save("sample.zip", { format: "SVG" });

  ### Example

  Save document pages as PNG images

      await viewer.save("sample.zip", { format: "SVG" });

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

  ### Example

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

  ### Example

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

  ### Example

      // 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();

- ##### `Optional` progressMessage?: string

  Custom progress message to be displayed during save.

      viewer.save("sample.pdf", { pages: "[angle:90]0,1-5", progressMessage: "Rotating first page..." }, reload: true);

- ##### `Optional` progressTitle?: string

  Custom progress title to be displayed during save.

      viewer.save("sample.pdf", { pages: "[angle:90]0,1-5", progressTitle: "Rotating" }, reload: true);

- ##### `Optional` reload?: boolean

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

  ### Example0

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

- ##### `Optional` saveMode?: "Auto" | "Default" | "Linearized" | "IncrementalUpdate"

  Defines the mode of saving a PDF.

  ### Default

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

- ##### `Optional` sign?: SignatureInfo

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

- ##### `Optional` zoomFactor?: number

  Zoom factor to be used for rendering images when the target format is "PNG".

      viewer.save("sample.pdf", { format: "PNG", zoomFactor: 1.5 });