Web SDKv1.0.0

Export

What the toolbar's Download button does: the default file name, whether fields and comments are flattened into the page, whether the button asks first, and whether a "Saved" confirmation follows. Download, doc.save() and every PDFExporter method need a license that includes export.
ExportConfigconfig.export

Example

viewer.tsTypeScript
new PDFViewer(container, doc, {
  export: {
    defaultFilename: 'contract.pdf',
    flatten: true, // every Download locks answers and comments into the page
  },
});

Options 4

defaultFilenamestringDefault'document.pdf'
Default filename for download. The Download dialog starts from it; with askOnDownload: false the file is saved under it straight away.
flattenbooleanDefaultfalse
Flatten on export: every page's fields and comments, as the page prints (anything not marked to print — a form field included — is dropped); the form itself is removed. By default a download keeps comments and form fields as they are: anyone can still select, edit, reply to or remove them in Acrobat or any other reader, as with Acrobat's own downloads. To hand out locked documents — signed forms, final contracts — turn flattening on for every download, or per call with exporter.download(name, { flatten: true }). In the Download dialog this is the one setting that cannot be undone — Lock in form answers and annotations — starting from flatten, and grayed out on a signed document with the reason, since the signature would not survive.
flattenTypeScript
export: { flatten: true } // every Download locks answers and comments into the page
askOnDownloadbooleanDefaulttrue
Toolbar Download asks first: file name, pages (all, current, or a range such as 1-3, 5), and the flatten decision, with the approximate size under it. false saves straight away with defaultFilename / flatten (never locking in a signed document). The progress card and the "Saved" confirmation still show. The Print button's question is print.ask.
askOnDownloadTypeScript
export: { askOnDownload: false }
successToastbooleanDefaulttrue
"Saved · 3 pages, 1.2 MB" after Download. false drops the confirmation (screen readers are still told). The confirmation says when a PDF/A claim was dropped.
successToastTypeScript
export: { successToast: false }

Notes

Three ways to shape the toolbar's Download and Print buttons. Hide them — toolbar.download: false, toolbar.print: false; with Print hidden, Ctrl / ⌘ + P is left to the browser. Take them over — callbacks.onDownload / callbacks.onPrint: when set, the SDK's dialog and flow do not run; your function does (get the bytes from viewer.createExporter(), print with viewer.print({ pages })); Ctrl / ⌘ + P goes to onPrint too. Skip the question — export.askOnDownload: false saves straight away; print.ask: false prints every page.

Print asks for a page range and whether annotations print, above a thumbnail of the first page; both Download and Print show a determinate, cancelable progress card while they work.

Per-call export options (exporter.download(name?, options), getBlob, getArrayBuffer, getBase64) take flatten, invalidateSignatures (a flattening export of a signed document is refused with INVALID_STATE without it), pages (zero-based, in that order), onProgress(done, total) and signal (an AbortSignal; aborting rejects with ABORTED); download() resolves { sizeBytes, pdfA? } (a DownloadResult). viewer.print({ pages?, annotations? }) prints without asking. See PDFExporter.

A page range is a new document, and a new document has no form: the pages in it that carry form fields are flattened even with flatten off, so the answers stay on the page instead of in fields no reader would fill. Its other pages keep their comments editable. Download the whole document to keep a form fillable. A page range of a signed document is unsigned by construction, a new file the signature never covered, so it is not refused.

PDF/A files. A PDF/A file (the archival profile of PDF) says so in its XMP metadata; doc.pdfA reads that claim — { part: 2, conformance: 'B' } — or is null. The SDK does not check what it writes against PDF/A, so a saved file keeps the claim only when nothing changed it. Unchanged — no edit, no filled field, no flatten, no watermark — a download, export or doc.save() returns the bytes the file was opened from, claim and all, not re-saved or re-dated. Changed — the file is saved without the claim, a plain PDF, and the modification date in its XMP metadata matches the file's new modification date. A page range is a new document and never carries it.

PDF/A reporting. download() and the exportCompleted event report pdfA: 'kept' | 'dropped' for a document that claims PDF/A, and nothing for one that does not. The Download dialog says the file is PDF/A, and the confirmation says when the claim was dropped. A changed file is never saved with the claim: when the claim cannot be edited out of the metadata, the metadata packet is removed, and when that cannot be done either the export (and doc.save()) fails with EXPORT_FAILED rather than hand out a file that claims PDF/A. To deliver a changed file as PDF/A, convert the download with a PDF/A tool.

PDF/A limits. A claim stored in compressed metadata is not read (PDF/A producers write it plain), a metadata packet over 1 MiB is not read either (such a file is treated as making no claim, so a changed copy keeps its packet as it was), and an encrypted file — which PDF/A does not allow — goes out as a changed file whose claim is dropped ('dropped'), its metadata packet removed when the claim cannot be edited.