PDFViewer.clientToPage()
The reverse of pageToClient: CSS pixels from the container's top-left corner, as the page holds them.
methodCoordinatessince 1.0.0
Signature
clientToPage<T extends Rect | Point>(value: T, pageIndex: number): T | null
Parameters
| Parameter | Type | Description |
|---|---|---|
| value | Rect | Point | CSS pixels from the container's top-left corner. |
| pageIndex | number | Zero-based page index. |
Returns
Rect | Point | null null before the page is laid out, or on a destroyed viewer.
Throws
INVALID_ARGUMENTfor a page index the document has not, or a value that is neither aPointnor aRectof finite numbers.
Example
TypeScript
container.addEventListener('click', (e) => { const bounds = container.getBoundingClientRect(); const at = viewer.clientToPage({ x: e.clientX - bounds.left, y: e.clientY - bounds.top }, 0); // at: where on page 0 the user clicked, in page space, or null });