PDFFileElement

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 PDFFileElement interface provides properties and methods for loading, saving and verifying a PDF document with the <pdf-file> element. It inherits properties and methods from PDFElement and HTMLElement.

EventTargetNodeElementHTMLElementPDFElementPDFFileElement

Instance properties

Also inherits properties from its parent interface, PDFElement.

PDFFileElement.controls

A boolean value: viewer controls on the file's pages. Reflects controls.

PDFFileElement.data

The bytes of the PDF as it loaded: a Uint8Array, or a Promise for one. Setting it loads new bytes.

PDFFileElement.formData

An object of the form field values, by annotation ID.

PDFFileElement.ium

A boolean value: the file's pages draw with PDFium by default. Reflects ium.

PDFFileElement.js Read only

The PDF.js PDFDocumentProxy of the file.

PDFFileElement.max Read only

An object whose imageSize reflects max:image-size.

PDFFileElement.name

A string: the file name the IO methods save under.

PDFFileElement.off Read only

A DOMTokenList of the parts the file's pages leave out. Reflects -.

PDFFileElement.pages Read only

An Array of the pages that show the file.

PDFFileElement.password

A string: the password of an encrypted PDF. Reflects password.

PDFFileElement.proxy Read only

A Map of the URLs a failed fetch is retried through.

PDFFileElement.ready Read only

A boolean value: the element is connected and has a PDF to load.

PDFFileElement.signatures

A boolean value: signature cards on the file's pages. Reflects signatures.

PDFFileElement.signed Read only

A string: the worst signature status, or null when the file is not signed.

PDFFileElement.src

A string: the URL of the PDF. Reflects src.

PDFFileElement.trust Read only

An object whose srcdoc, src and stores reflect the trust:* attributes.

PDFFileElement.URL

The URL of the PDF as a URL object.

PDFFileElement.XFDF Read only

An object for loading and saving the form data as XFDF.

Instance methods

Also inherits methods from its parent interface, PDFElement.

PDFFileElement.close()

Forgets the remembered file handles and returns them.

PDFFileElement.download()

Downloads the PDF, or its form data.

PDFFileElement.export()

Resolves to the PDF, with its edits, as a File or a Blob.

PDFFileElement.load()

Loads a PDF from a URL, bytes, a Blob or a file, optionally with its XFDF.

PDFFileElement.open()

Shows a file picker and loads the PDF you pick.

PDFFileElement.save()

Saves the PDF with its form edits: to the opened file, or through a picker or a download.

PDFFileElement.saveAs()

Saves the PDF under a new name.

PDFFileElement.saveCopy()

Saves a copy of the PDF.

PDFFileElement.saveData()

Resolves to the bytes of the PDF, with its form edits.

PDFFileElement.verify()

Checks the digital signatures and resolves to one row per signature.

Events

Listen to these events using addEventListener(). WebPDF elements have no on… event handler properties.

error

The PDF or its XFDF failed to load.

load

The PDF has loaded.

verify

The signatures have been checked.

Examples

Rotating every page of a file

js
const file = document.querySelector("pdf-file");
file.addEventListener("load", () => {
  for (const page of file.pages) page.rotation = 90;
});

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
PDFFileElement
1251251531111812515383182712518
close()
1251251531111812515383182712518
controls
1251251531111812515383182712518
data
1251251531111812515383182712518
download()
1251251531111812515383182712518
error event
1251251531111812515383182712518
export()
1251251531111812515383182712518
formData
1251251531111812515383182712518
ium
1251251531111812515383182712518
js
1251251531111812515383182712518
load()
1251251531111812515383182712518
load event
1251251531111812515383182712518
max
1251251531111812515383182712518
name
1251251531111812515383182712518
off
1251251531111812515383182712518
open()
1251251531111812515383182712518
pages
1251251531111812515383182712518
password
1251251531111812515383182712518
proxy
1251251531111812515383182712518
ready
1251251531111812515383182712518
save()
1251251531111812515383182712518
saveAs()
1251251531111812515383182712518
saveCopy()
1251251531111812515383182712518
saveData()
1251251531111812515383182712518
signatures
1251251531111812515383182712518
signed
1251251531111812515383182712518
src
1251251531111812515383182712518
trust
1251251531111812515383182712518
URL
1251251531111812515383182712518
verify()
1251251531111812515383182712518
verify event
1251251531111812515383182712518
XFDF
1251251531111812515383182712518
  • signed · Chrome, Edge, Firefox, Opera, Safari, Chrome Android, Firefox for Android, Opera Android, Safari on iOS, Samsung Internet, WebView Android, WebView on iOS: Secure contexts (HTTPS) only; elsewhere every signature verifies as unknown.
  • trust · Chrome, Edge, Firefox, Opera, Safari, Chrome Android, Firefox for Android, Opera Android, Safari on iOS, Samsung Internet, WebView Android, WebView on iOS: Secure contexts (HTTPS) only; elsewhere every signature verifies as unknown.

Legend

Full support
See implementation notes.

See also