PDFPageElement: no 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 no property of the PDFPageElement interface sets or returns the page number a <pdf-page> shows. It reflects the no HTML attribute.

Value

An integer. Positive numbers count from the start, so 1 (the default) is the first page; negative numbers count from the end, so -1 is the last page. The value is clamped to the page count: on a 4-page file, 9 shows page 4 and -9 page 1.

+Infinity (written as no=+Infinity) always shows the last page, even after the file changes. Setting 1 removes the attribute, and setting 0 is ignored.

The keyboard and the bar change no on a page with controls: ← →, A D, Home End and the bar's ‹ › buttons. Home and End keep the sign of a negative number, so they write -4 and -1 on a page that counts from the end. Alt ← and Alt → go round the ends, from the last page to the first and back, also keeping the sign.

Examples

Showing the first and the last page

One file, two pages: the first one and the last one, however many pages the file has.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f scale=0.3></pdf-page>
<pdf-page of=f no=-1 scale=0.3></pdf-page>

Result

Turning pages from script

no counts from the end when it is negative, so going forward means adding one either way:
js
const page = document.querySelector("pdf-page");
page.no++;              // the next page
page.no = -1;           // the last page
page.no = +Infinity;    // the last page, also after the file changes

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

Legend

Full support

See also