PDFFileElement: saveData() 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 saveData() method of the PDFFileElement interface returns the bytes of the PDF of a <pdf-file>, with its form edits.

With form edits, PDF.js writes a new revision of the file; without, you get the original bytes.

Syntax

js
saveData()
saveData(options)

Parameters

options Optional

An object with a noEdit property: true returns the bytes as they were when the file loaded.

Return value

A Promise that resolves to a Uint8Array.

Exceptions

None.

Examples

Uploading a filled form

js
const file = document.querySelector("pdf-file");
const bytes = await file.saveData();
await fetch("/upload", { method: "POST", body: bytes });

Specifications

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

Specification
ISO 32000-2:2020 (PDF 2.0)
# 12.7 Forms

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

Legend

Full support

See also