Interactive canvas preview created and owned by a PdfDocument.
The viewer replaces the target's children with one isolated Shadow DOM
subtree. Dispose it to cancel rendering, destroy PDF.js state, and clear the
target. Construct previews through PdfDocument.preview.
Signature
export declare class PdfPreviewProperties
| Property | Type | Required | Read only | Default | Description |
|---|---|---|---|---|---|
element | HTMLElement | Yes | Yes | None | Host element inserted into the preview target. |
currentScale | number | Yes | Yes | None | Current logical PDF.js scale after option clamping. |
currentTheme | PdfPreviewTheme | Yes | Yes | None | Current preview-control theme, including the default system mode. |
Methods
setTheme()
Updates the preview-control theme without rerendering the PDF pages.
setTheme(theme: PdfPreviewTheme): void;Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
theme | PdfPreviewTheme | Yes | None | Preview control theme. |
Returns
voidsetScale()
Sets a clamped scale and rerenders every page canvas.
setScale(value: number): Promise<void>;Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
value | number | Yes | None | Value to apply. |
Returns
Promise<void>fitToWidth()
Fits the first page to the available viewer width and rerenders all pages.
fitToWidth(): Promise<void>;Parameters
This API does not accept parameters.
Returns
Promise<void>dispose()
Cancels active work, destroys PDF.js state, and clears the target.
dispose(): void;Parameters
This API does not accept parameters.
Returns
void