PDFPageElement: offset 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 offset property of the PDFPageElement interface returns an object for shifting the content of a <pdf-page> inside its box. Its x and y properties reflect the offset:x and offset:y HTML attributes.

Value

An object with two properties:

x

A number of CSS pixels to move the content right (negative: left). The default is 0.

y

A number of CSS pixels to move the content down (negative: up). The default is 0.

The box keeps its size; the content that moves out of it is clipped. Changing an offset draws every layer again: the image, the text and the annotations move together.

Examples

Showing a detail of a page

A smaller box and a negative offset show only the part of the page you want.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f scale=0.5 offset:x=-60 offset:y=-120></pdf-page>

CSS

css
pdf-page {
  width: 280px;
  height: 180px;
}

Result

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

Legend

Full support

See also