PDFFileElement: download() 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 download() method of the PDFFileElement interface downloads the PDF of a <pdf-file>, or its form data, with an <a download> link.

The browser may rename the download when a file of that name exists, for example form (1).pdf.

Syntax

js
download()
download(options)

Parameters

options Optional

As for PDFFileElement.save(). A name ending in .xfdf downloads the form data instead of the PDF.

Return value

A Promise that resolves to undefined.

Exceptions

None.

Examples

Downloading the PDF and its form data

js
const file = document.querySelector("pdf-file");
await file.download();
await file.download({ name: "form.xfdf" });

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
download()
1251251531111812515383182712518

Legend

Full support

See also