PDFFileElement: export() method

Works in all major browsers
Since July 2026

WebPDF works in Chrome and Edge 125, Firefox 153 and Safari 18, on desktop and mobile, and in every later version: the oldest versions its PDF.js build supports, which already have every platform feature WebPDF needs. Since July 2026, that is every major browser.

The export() method of the PDFFileElement interface returns the PDF of a <pdf-file>, with its form edits, as a File or a Blob.

Syntax

js
export()
export(type)
export(options)

Parameters

type Optional

File (the default) or Blob.

options Optional

An object with a type property and the options of PDFFileElement.saveData(), such as noEdit, and a name for the File.

Return value

A Promise that resolves to a File or a Blob of type application/pdf, or to undefined for any other type.

Exceptions

None.

Examples

Exporting in different types

js
const file = document.querySelector("pdf-file");
await file.export();                               // File
await file.export({ name: "a.pdf" });              // File named a.pdf
await file.export(Blob);                           // Blob
await file.export({ type: Blob, noEdit: true });   // Blob, without the edits

Specifications

Not part of any specification. <pdf-file> and <pdf-page> are autonomous custom elements defined by WebPDF.pro.

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
export()
1251251531111812515383182712518

Legend

Full support

See also