PDFPageElement: off 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 off property of the PDFPageElement interface returns a live DOMTokenList of the parts of a <pdf-page> that are turned off. It reflects the - HTML attribute.

Value

A DOMTokenList of the page's own tokens:

text

Leaves out the text layer, so text cannot be selected or found.

anno

Leaves out the annotation layer: links and form fields. Forms are then drawn into the image.

js

Leaves PDF.js out of a page that PDFium draws: PDFium alone reads it, so its page count, size, image, text, links and buttons come from PDFium, and a page that PDF.js cannot read still shows. PDF.js and SVG pages ignore it. See Choosing a renderer.

drop

Ignores files and links dropped on the page.

controls

Turns all controls off, whatever controls says, anywhere up the chain.

The attribute is multi-homed: the tokens of the <script>, the file and the page add up. A token prefixed with - keeps an inherited part on (-=-text), and a bare - drops every inherited token.

With controls, Alt T and Alt A toggle text and anno.

Examples

Drawing only the image

Without the text and annotation layers a page is a plain image: nothing to select, no links.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f -="text anno" scale=0.4></pdf-page>

Result

Toggling a layer from script

js
const page = document.querySelector("pdf-page");
page.off.toggle("text"); // -=text
page.off.add("drop");    // -="text drop"

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

Legend

Full support

See also