PDFFileElement: name property

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 name property of the PDFFileElement interface sets or returns the file name of a <pdf-file>: the name its IO methods save under.

Value

A string. With a src, it is the last part of the URL, and setting it changes the URL, which loads the file again. Otherwise it is the name you set, or the name of the file you opened, or "data.pdf".

PDFFileElement.save(), PDFFileElement.download() and PDFFileElement.export() use it as their default name.

Examples

Naming a file loaded from data

js
const file = document.querySelector("pdf-file");
file.data = new Uint8Array(await (await fetch("report.pdf")).arrayBuffer());
file.name = "report.pdf";
await file.save();

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
name
1251251531111812515383182712518

Legend

Full support

See also