Skip to content

PDFiumPage

@scaryterry/pdfium


Defined in: src/document/page.ts:153

Represents a single page in a PDF document.

Pages are loaded lazily and must be disposed when no longer needed. Use the using keyword for automatic disposal.

using page = document.getPage(0);
const size = page.size;
console.log(`Page size: ${size.width}x${size.height}`);

get annotationCount(): number

Defined in: src/document/page.ts:1058

Get the number of annotations on this page.

number


get artBox(): PageBox | undefined

Defined in: src/document/page.ts:426

Get the art box (content boundaries).

This is a convenience method equivalent to getPageBox(PageBoxType.ArtBox).

PageBox | undefined

The art box or undefined if not explicitly set


get bleedBox(): PageBox | undefined

Defined in: src/document/page.ts:404

Get the bleed box (printing bleed area).

This is a convenience method equivalent to getPageBox(PageBoxType.BleedBox).

PageBox | undefined

The bleed box or undefined if not explicitly set


get boundingBox(): PageBox

Defined in: src/document/page.ts:438

Get the effective bounding box of the page.

This returns the bounding box that encompasses all page content, considering all page transformations.

PageBox

The page bounding box


get charCount(): number

Defined in: src/document/page.ts:2041

Get the total number of characters on this page.

This includes all text characters that can be extracted.

number


get cropBox(): PageBox | undefined

Defined in: src/document/page.ts:393

Get the crop box (visible region).

This is a convenience method equivalent to getPageBox(PageBoxType.CropBox).

PageBox | undefined

The crop box or undefined if not explicitly set


get disposed(): boolean

Defined in: src/core/disposable.ts:73

Whether this resource has been disposed.

boolean

Disposable.disposed


get height(): number

Defined in: src/document/page.ts:267

Get the height of the page in points.

number

IPageReader.height


get index(): number

Defined in: src/document/page.ts:244

The zero-based index of this page.

number

The zero-based index of this page.

IPageReader.index


get mediaBox(): PageBox | undefined

Defined in: src/document/page.ts:382

Get the media box (physical page boundaries).

This is a convenience method equivalent to getPageBox(PageBoxType.MediaBox).

PageBox | undefined

The media box or undefined if not set


get objectCount(): number

Defined in: src/document/page.ts:1010

Get the number of objects on this page.

number


get rotation(): PageRotation

Defined in: src/document/page.ts:275

Get the page rotation as stored in the PDF.

PageRotation

set rotation(rotation): void

Defined in: src/document/page.ts:286

Set the page rotation.

ParameterTypeDescription
rotationPageRotationThe rotation value to set

void

Page rotation.

IPageReader.rotation


get size(): PageSize

Defined in: src/document/page.ts:251

Get the page dimensions in points (1/72 inch).

PageSize

Page dimensions.

IPageReader.size


get trimBox(): PageBox | undefined

Defined in: src/document/page.ts:415

Get the trim box (final trimmed dimensions).

This is a convenience method equivalent to getPageBox(PageBoxType.TrimBox).

PageBox | undefined

The trim box or undefined if not explicitly set


get webLinkCount(): number

Defined in: src/document/page.ts:2694

Count the number of web links detected in the page text.

Web links are URLs automatically detected in the page text content, not interactive link annotations.

number


get width(): number

Defined in: src/document/page.ts:259

Get the width of the page in points.

number

IPageReader.width

[dispose](): void

Defined in: src/core/disposable.ts:148

Dispose of this resource, freeing WASM memory.

This method is idempotent - calling it multiple times has no effect after the first call.

void

IPageReader.[dispose]

Disposable.[dispose]


annotations(): IterableIterator<PDFiumAnnotation>

Defined in: src/document/page.ts:1149

Iterate annotations on this page lazily.

Each yielded annotation holds an open native handle — use using or call dispose() when done. Annotations are opened one at a time, making this more memory-efficient than getAnnotations() for large annotation sets.

IterableIterator<PDFiumAnnotation>


canFormRedo(): boolean

Defined in: src/document/page.ts:1255

Check if redo is available for form field editing on this page.

boolean


canFormUndo(): boolean

Defined in: src/document/page.ts:1244

Check if undo is available for form field editing on this page.

boolean


createAnnotation(type): PDFiumAnnotation | null

Defined in: src/document/page.ts:1708

Create a new annotation on this page.

ParameterTypeDescription
typeAnnotationTypeThe annotation type to create

PDFiumAnnotation | null

The new annotation, or null if creation failed


createImageObject(): PDFiumImageObject | null

Defined in: src/document/page.ts:1647

Create a new image page object.

The returned object must be inserted into a page or annotation, or destroyed via obj.destroy().

PDFiumImageObject | null

A new image page object, or null if failed


deviceToPage(context, deviceX, deviceY): PageCoordinate

Defined in: src/document/page.ts:2983

Convert device coordinates (pixels) to page coordinates (points).

This is useful for translating mouse click positions into page space for operations like text selection or hit testing.

ParameterTypeDescription
contextCoordinateTransformContextThe coordinate transform context defining the viewport
deviceXnumberX coordinate in device space (pixels)
deviceYnumberY coordinate in device space (pixels)

PageCoordinate

The corresponding point in page coordinate space

const context = {
startX: 0,
startY: 0,
sizeX: 800,
sizeY: 600,
rotate: PageRotation.None,
};
const pageCoord = page.deviceToPage(context, mouseX, mouseY);

If the device coordinates are not finite numbers


dispose(): void

Defined in: src/core/disposable.ts:164

Alias for Symbol.dispose for explicit calls.

void

document.dispose();

Disposable.dispose


executePageAction(actionType): void

Defined in: src/document/page.ts:3085

Executes a page action for forms.

Triggers JavaScript actions associated with page events (open/close). This is used to run any scripts that are attached to page lifecycle events in interactive PDF forms.

ParameterTypeDescription
actionTypePageActionTypeThe type of page action to execute

void

// Trigger page open action
page.executePageAction(PageActionType.Open);
// Before closing, trigger close action
page.executePageAction(PageActionType.Close);

findText(query, flags): IterableIterator<TextSearchResult>

Defined in: src/document/page.ts:1827

Search for text on this page.

Returns a generator yielding search results with position information. The search handle is cleaned up when the generator finishes or is closed.

ParameterTypeDefault valueDescription
querystringundefinedThe text to search for
flagsTextSearchFlagsTextSearchFlags.NoneSearch flags (case sensitivity, whole word, etc.)

IterableIterator<TextSearchResult>

If the text page fails to load

IPageReader.findText


flatten(flags): FlattenResult

Defined in: src/document/page.ts:1547

Flatten annotations and form fields into page content.

After flattening, annotations and form fields become part of the page content and can no longer be edited separately.

ParameterTypeDefault valueDescription
flagsFlattenFlagsFlattenFlags.NormalDisplayFlatten flags (0 for normal display, 1 for print)

FlattenResult

The flatten result


formChar(charCode, modifier): boolean

Defined in: src/document/page.ts:1440

Notify form fill environment of a character input event.

ParameterTypeDescription
charCodenumberCharacter code
modifierFormModifierFlagsKeyboard modifier flags

boolean

True if the event was handled


formDoubleClick(modifier, x, y): boolean

Defined in: src/document/page.ts:1395

Notify form fill environment of a double-click event.

ParameterTypeDescription
modifierFormModifierFlagsKeyboard modifier flags
xnumberX coordinate in page space
ynumberY coordinate in page space

boolean

True if the event was handled


formFocus(modifier, x, y): boolean

Defined in: src/document/page.ts:1343

Notify form fill environment of focus at a point.

ParameterTypeDescription
modifierFormModifierFlagsKeyboard modifier flags
xnumberX coordinate in page space
ynumberY coordinate in page space

boolean

True if the event was handled


formKeyDown(keyCode, modifier): boolean

Defined in: src/document/page.ts:1410

Notify form fill environment of a key down event.

ParameterTypeDescription
keyCodenumberVirtual key code
modifierFormModifierFlagsKeyboard modifier flags

boolean

True if the event was handled


formKeyUp(keyCode, modifier): boolean

Defined in: src/document/page.ts:1425

Notify form fill environment of a key up event.

ParameterTypeDescription
keyCodenumberVirtual key code
modifierFormModifierFlagsKeyboard modifier flags

boolean

True if the event was handled


formMouseDown(button, modifier, x, y): boolean

Defined in: src/document/page.ts:1360

Notify form fill environment of a mouse button down event.

ParameterTypeDescription
buttonFormMouseButtonWhich mouse button (‘left’ or ‘right’)
modifierFormModifierFlagsKeyboard modifier flags
xnumberX coordinate in page space
ynumberY coordinate in page space

boolean

True if the event was handled


formMouseMove(modifier, x, y): boolean

Defined in: src/document/page.ts:1301

Notify form fill environment of mouse movement.

ParameterTypeDescription
modifierFormModifierFlagsKeyboard modifier flags (shift, ctrl, alt)
xnumberX coordinate in page space
ynumberY coordinate in page space

boolean

True if the event was handled


formMouseUp(button, modifier, x, y): boolean

Defined in: src/document/page.ts:1378

Notify form fill environment of a mouse button up event.

ParameterTypeDescription
buttonFormMouseButtonWhich mouse button (‘left’ or ‘right’)
modifierFormModifierFlagsKeyboard modifier flags
xnumberX coordinate in page space
ynumberY coordinate in page space

boolean

True if the event was handled


formMouseWheel(modifier, x, y, deltaX, deltaY): boolean

Defined in: src/document/page.ts:1319

Notify form fill environment of mouse wheel scroll.

ParameterTypeDescription
modifierFormModifierFlagsKeyboard modifier flags
xnumberX coordinate in page space
ynumberY coordinate in page space
deltaXnumberHorizontal scroll delta
deltaYnumberVertical scroll delta

boolean

True if the event was handled


formRedo(): boolean

Defined in: src/document/page.ts:1281

Redo the last undone form field editing operation on this page.

boolean

True if redo was successful


formSelectAllText(): boolean

Defined in: src/document/page.ts:1497

Select all text in the currently focused form field.

boolean

True if successful


formUndo(): boolean

Defined in: src/document/page.ts:1268

Undo the last form field editing operation on this page.

boolean

True if undo was successful


generateContent(): boolean

Defined in: src/document/page.ts:1586

Generate the page content stream.

Call this after modifying page objects to persist changes.

boolean

True if successful


getAnnotation(index): PDFiumAnnotation

Defined in: src/document/page.ts:1073

Get an annotation by index.

The returned annotation holds an open native handle and a borrow on this page’s resources. Dispose the annotation when done.

ParameterTypeDescription
indexnumberZero-based annotation index

PDFiumAnnotation

The annotation wrapper

If the index is out of range or the annotation cannot be loaded


getAnnotations(): PDFiumAnnotation[]

Defined in: src/document/page.ts:1125

Get all annotations on this page.

Important: Each annotation holds an open native handle that retains the page’s native resources. You must dispose every annotation when done, otherwise native memory will not be freed.

For memory-efficient iteration, prefer the annotations() generator which yields one annotation at a time with using support.

PDFiumAnnotation[]

// Array pattern — caller must dispose each annotation
const annots = page.getAnnotations();
try {
for (const annot of annots) { console.log(annot.type); }
} finally {
for (const annot of annots) { annot.dispose(); }
}
// Generator pattern (preferred) — automatic disposal
for (using annot of page.annotations()) {
console.log(annot.type);
}

IPageReader.getAnnotations


getCharacterInfo(charIndex): CharacterInfo | undefined

Defined in: src/document/page.ts:2280

Get extended information about a character at the specified index.

This combines multiple character properties into a single object for convenience when you need comprehensive character information.

ParameterTypeDescription
charIndexnumberZero-based character index

CharacterInfo | undefined

Character info or undefined if invalid index


getCharAngle(charIndex): number

Defined in: src/document/page.ts:2143

Get the rotation angle of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

number

Rotation angle in radians


getCharBox(charIndex): CharBox | undefined

Defined in: src/document/page.ts:1849

Get the bounding box of a character by its index.

ParameterTypeDescription
charIndexnumberZero-based character index

CharBox | undefined

The character bounding box, or undefined if the index is invalid

If the text page fails to load


getCharFillColour(charIndex): Colour | undefined

Defined in: src/document/page.ts:2241

Get the fill colour of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

Colour | undefined

Fill colour or undefined if unavailable


getCharFontName(charIndex): string | undefined

Defined in: src/document/page.ts:2107

Get the font name of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

string | undefined

Font name, or undefined if unavailable


getCharFontSize(charIndex): number

Defined in: src/document/page.ts:2071

Get the font size of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

number

Font size in points, or 0 if invalid


getCharFontWeight(charIndex): number

Defined in: src/document/page.ts:2089

Get the font weight of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

number

Font weight (100-900), or -1 if invalid/unavailable


getCharIndexAtPos(x, y, xTolerance, yTolerance): number

Defined in: src/document/page.ts:1895

Get the character index at a given position in page coordinates.

ParameterTypeDefault valueDescription
xnumberundefinedX position in page coordinates
ynumberundefinedY position in page coordinates
xTolerancenumberDEFAULT_CHAR_POSITION_TOLERANCEHorizontal tolerance in points (default: 10)
yTolerancenumberDEFAULT_CHAR_POSITION_TOLERANCEVertical tolerance in points (default: 10)

number

The zero-based character index, or -1 if no character is at the position, or -3 if the position is outside the page


getCharLooseBox(charIndex): CharBox | undefined

Defined in: src/document/page.ts:1867

Get the loose bounding box of a character by its index.

ParameterTypeDescription
charIndexnumberZero-based character index

CharBox | undefined

The character loose bounding box, or undefined if the index is invalid


getCharOrigin(charIndex): { x: number; y: number; } | undefined

Defined in: src/document/page.ts:2163

Get the origin point of a character at the specified index.

The origin is typically at the baseline of the character.

ParameterTypeDescription
charIndexnumberZero-based character index

{ x: number; y: number; } | undefined

Origin point {x, y} or undefined if invalid


getCharRenderMode(charIndex): TextRenderMode

Defined in: src/document/page.ts:2125

Get the text render mode of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

TextRenderMode

Text render mode


getCharStrokeColour(charIndex): Colour | undefined

Defined in: src/document/page.ts:2259

Get the stroke colour of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

Colour | undefined

Stroke colour or undefined if unavailable


getCharUnicode(charIndex): number

Defined in: src/document/page.ts:2053

Get the Unicode code point of a character at the specified index.

ParameterTypeDescription
charIndexnumberZero-based character index

number

Unicode code point, or 0 if invalid


getDecodedThumbnailData(): Uint8Array<ArrayBufferLike> | undefined

Defined in: src/document/page.ts:560

Get the decoded thumbnail image data.

This returns the raw pixel data of the embedded thumbnail image, decoded from whatever format it was stored in (typically JPEG).

Uint8Array<ArrayBufferLike> | undefined

The decoded thumbnail pixel data, or undefined if not available


getFocusableSubtypes(): AnnotationType[]

Defined in: src/document/page.ts:1759

Get the focusable annotation subtypes.

AnnotationType[]

Array of focusable annotation types


getFocusableSubtypesCount(): number

Defined in: src/document/page.ts:1744

Get the count of focusable annotation subtypes.

number

The number of focusable subtypes


getFormFieldTypeAtPoint(x, y): FormFieldType | null

Defined in: src/document/page.ts:1170

Get the form field type at the specified point.

ParameterTypeDescription
xnumberX coordinate in page coordinates
ynumberY coordinate in page coordinates

FormFieldType | null

The form field type at the point, or null if none


getFormFieldZOrderAtPoint(x, y): number

Defined in: src/document/page.ts:1189

Get the Z-order of a form field at the specified point.

ParameterTypeDescription
xnumberX coordinate in page coordinates
ynumberY coordinate in page coordinates

number

The Z-order of the form field at the point, or -1 if none


getFormFocusedText(): string | undefined

Defined in: src/document/page.ts:1453

Get the text in the currently focused form field.

string | undefined

The focused text, or undefined if no focused field


getFormSelectedText(): string | undefined

Defined in: src/document/page.ts:1202

Get the currently selected text in a form field on this page.

string | undefined

The selected text, or undefined if no selection


getLinkAtPoint(x, y): PDFLink | null

Defined in: src/document/page.ts:2613

Get the link at a specific point on the page.

ParameterTypeDescription
xnumberX coordinate in page units
ynumberY coordinate in page units

PDFLink | null

The link at the point, or null if none


getLinks(): PDFLink[]

Defined in: src/document/page.ts:2684

Enumerate all links on the page.

For pages with many links, prefer using the links() generator.

PDFLink[]

Array of links found on the page


getLinkZOrderAtPoint(x, y): number

Defined in: src/document/page.ts:2633

Get the z-order of the link at a specific point.

Returns the z-order index (0-based, where 0 is bottom) of the link at the specified point, or -1 if no link is found.

ParameterTypeDescription
xnumberX coordinate in page units
ynumberY coordinate in page units

number


getObjects(): PDFiumPageObject[]

Defined in: src/document/page.ts:1051

Get all page objects (text, images, paths, etc.).

For large pages, prefer using the objects() generator.

PDFiumPageObject[]

An array of page objects with type and bounding box information

IPageReader.getObjects


getPageBox(boxType): PageBox | undefined

Defined in: src/document/page.ts:304

Get a specific page box.

PDF pages can have multiple box definitions:

  • MediaBox: Physical page boundaries (required)
  • CropBox: Visible region (defaults to MediaBox)
  • BleedBox: Bleed area for printing (defaults to CropBox)
  • TrimBox: Final trimmed page dimensions (defaults to CropBox)
  • ArtBox: Meaningful content boundaries (defaults to CropBox)
ParameterTypeDescription
boxTypePageBoxTypeThe type of box to retrieve

PageBox | undefined

The page box or undefined if not explicitly set

IPageReader.getPageBox


getRawThumbnailData(): Uint8Array<ArrayBufferLike> | undefined

Defined in: src/document/page.ts:575

Get the raw thumbnail image data.

This returns the thumbnail data in its original encoded format (e.g., JPEG, PNG). The format can be determined from the data header.

Uint8Array<ArrayBufferLike> | undefined

The raw thumbnail data, or undefined if not available


getStructureTree(): StructureElement[] | undefined

Defined in: src/document/page.ts:2344

Get the structure tree for this page (tagged PDF accessibility info).

Returns an array of root structure elements, or undefined if the page has no structure tree (i.e. the PDF is not tagged).

For large structure trees, prefer the lazy structureElements generator.

StructureElement[] | undefined


getText(): string

Defined in: src/document/page.ts:987

Extract text content from the page.

Returns the full text of the page as a single string. The text preserves the logical reading order determined by PDFium, including whitespace and line breaks embedded in the PDF content stream. No trimming is applied.

string

The extracted text

If text extraction fails

getTextInRect for extracting text within a bounding rectangle

IPageReader.getText


getTextInRect(left, top, right, bottom): string

Defined in: src/document/page.ts:1918

Get the text within a rectangular region of the page.

ParameterTypeDescription
leftnumberLeft edge of the rectangle in page coordinates
topnumberTop edge of the rectangle in page coordinates
rightnumberRight edge of the rectangle in page coordinates
bottomnumberBottom edge of the rectangle in page coordinates

string

The text within the rectangle (no trimming is applied)

getText for extracting all text on the page


getTextLayout(): object

Defined in: src/document/page.ts:1968

Get efficient text layout data (characters and bounding boxes).

Optimised for bulk extraction. Returns a single string of text and a flat Float32Array of bounding boxes — 4 values per character in the order [left, right, bottom, top], so rects.length === text.length * 4. Access character i bounds via rects[i*4] (left), rects[i*4+1] (right), rects[i*4+2] (bottom), rects[i*4+3] (top).

object

Object containing { text, rects }

NameTypeDefined in
rectsFloat32Arraysrc/document/page.ts:1968
textstringsrc/document/page.ts:1968

getThumbnailAsBitmap(): RenderResult | undefined

Defined in: src/document/page.ts:504

Get the embedded thumbnail image as a rendered result.

Returns the thumbnail as RGBA pixel data in a RenderResult, matching the format returned by render.

RenderResult | undefined

The thumbnail as a render result, or undefined if not available


getWebLinks(): WebLink[]

Defined in: src/document/page.ts:2715

Get automatically detected web links from the page text.

These are URLs found in the text content, not interactive link annotations.

WebLink[]

Array of detected web links with their URLs and positions


hasCharUnicodeMapError(charIndex): boolean

Defined in: src/document/page.ts:2223

Check if a character at the specified index has a Unicode mapping error.

This indicates the character could not be properly mapped to Unicode during text extraction.

ParameterTypeDescription
charIndexnumberZero-based character index

boolean


hasThumbnail(): boolean

Defined in: src/document/page.ts:488

Check if the page has an embedded thumbnail image.

boolean

True if a thumbnail exists, false otherwise


hasTransparency(): boolean

Defined in: src/document/page.ts:1561

Check if this page contains transparency.

boolean

True if the page contains transparency


isAnnotationObjectSubtypeSupported(subtype): boolean

Defined in: src/document/page.ts:1734

Check if an annotation subtype supports adding/updating/removing objects.

Currently supported subtypes are ink and stamp.

ParameterTypeDescription
subtypeAnnotationTypeThe annotation subtype to check

boolean

True if the subtype supports object operations


isAnnotationSubtypeSupported(subtype): boolean

Defined in: src/document/page.ts:1721

Check if an annotation subtype is supported for object extraction.

ParameterTypeDescription
subtypeAnnotationTypeThe annotation subtype to check

boolean

True if the subtype supports object operations


isCharGenerated(charIndex): boolean

Defined in: src/document/page.ts:2183

Check if a character at the specified index was generated.

Generated characters are not from the original PDF content stream, but were synthesised during text extraction.

ParameterTypeDescription
charIndexnumberZero-based character index

boolean


isCharHyphen(charIndex): boolean

Defined in: src/document/page.ts:2203

Check if a character at the specified index is a hyphen.

This can be used to detect soft hyphens that may indicate word breaks across lines.

ParameterTypeDescription
charIndexnumberZero-based character index

boolean


isFormIndexSelected(index): boolean

Defined in: src/document/page.ts:1526

Check if an index is selected in a listbox or combobox.

ParameterTypeDescription
indexnumberThe option index to check

boolean

True if the index is selected


links(): IterableIterator<PDFLink>

Defined in: src/document/page.ts:2650

Iterate over links lazily.

Use this for memory-efficient iteration over many links.

IterableIterator<PDFLink>

for (const link of page.links()) {
console.log(link.actionType);
}

objects(): IterableIterator<PDFiumPageObject>

Defined in: src/document/page.ts:1027

Iterate over page objects lazily.

Use this for memory-efficient iteration over many page objects.

IterableIterator<PDFiumPageObject>

for (const obj of page.objects()) {
console.log(obj.type);
}

IPageReader.objects


pageToDevice(context, pageX, pageY): DeviceCoordinate

Defined in: src/document/page.ts:3036

Convert page coordinates (points) to device coordinates (pixels).

This is useful for positioning UI elements over specific page content or for drawing annotations at precise locations.

ParameterTypeDescription
contextCoordinateTransformContextThe coordinate transform context defining the viewport
pageXnumberX coordinate in page space (points)
pageYnumberY coordinate in page space (points)

DeviceCoordinate

The corresponding point in device coordinate space

const context = {
startX: 0,
startY: 0,
sizeX: 800,
sizeY: 600,
rotate: PageRotation.None,
};
const deviceCoord = page.pageToDevice(context, textBounds.left, textBounds.top);

If the page coordinates are not finite numbers


removeAnnotation(index): boolean

Defined in: src/document/page.ts:1697

Remove an annotation from this page.

ParameterTypeDescription
indexnumberZero-based annotation index

boolean

True if successful


removeObject(obj): boolean

Defined in: src/document/page.ts:1574

Remove a page object from this page.

After removal, call generateContent() to update the page content stream.

ParameterTypeDescription
objPDFiumPageObjectThe page object to remove

boolean

True if successful


render(options): RenderResult

Defined in: src/document/page.ts:589

Render the page to a bitmap.

ParameterTypeDescription
optionsRenderOptionsRendering options

RenderResult

The rendered bitmap data

If rendering fails

IPageReader.render


replaceFormSelection(text): void

Defined in: src/document/page.ts:1230

Replace the currently selected text in a form field.

ParameterTypeDescription
textstringThe text to replace the selection with

void


replaceFormSelectionAndKeep(text): void

Defined in: src/document/page.ts:1481

Replace the selected text in a form field and keep the selection.

ParameterTypeDescription
textstringThe text to replace the selection with

void


setClipPath(box): boolean

Defined in: src/document/page.ts:1628

Create, insert, and destroy a clip path in a single operation.

ParameterTypeDescription
boxPageBoxThe clip path rectangle in page coordinates

boolean

True if the clip path was created and inserted successfully


setFocusableSubtypes(subtypes): boolean

Defined in: src/document/page.ts:1796

Set the focusable annotation subtypes.

ParameterTypeDescription
subtypesAnnotationType[]Array of annotation types that should be focusable

boolean

True if successful


setFormIndexSelected(index, selected): boolean

Defined in: src/document/page.ts:1512

Set the selection state of an index in a listbox or combobox.

ParameterTypeDescription
indexnumberThe option index to select/deselect
selectedbooleanTrue to select, false to deselect

boolean

True if successful


setPageBox(boxType, box): void

Defined in: src/document/page.ts:353

Set a specific page box.

ParameterTypeDescription
boxTypePageBoxTypeThe type of box to set
boxPageBoxThe box coordinates in points

void


startProgressiveRender(options): ProgressiveRenderContext

Defined in: src/document/page.ts:710

Start progressive rendering of the page.

Returns a ProgressiveRenderContext that owns the render resources. Use continue() to advance the render, and dispose when done.

ParameterTypeDescription
optionsRenderOptionsRender options (same as render())

ProgressiveRenderContext

A disposable render context

If progressive rendering is unavailable or setup fails

using render = page.startProgressiveRender({ scale: 2 });
while (render.status === ProgressiveRenderStatus.ToBeContinued) {
render.continue();
}
if (render.status === ProgressiveRenderStatus.Done) {
const result = render.getResult();
}

IPageReader.startProgressiveRender


structureElements(): IterableIterator<StructureElement, any, any> | undefined

Defined in: src/document/page.ts:2391

Iterate over root structure elements lazily.

Each yielded element includes its full subtree of children (eagerly loaded). Returns undefined if the page has no structure tree.

The structure tree handle is kept open for the lifetime of the generator. Dispose or exhaust the generator to release it.

IterableIterator<StructureElement, any, any> | undefined

A generator yielding root-level structure elements, or undefined if the page is not tagged

If the structure tree depth exceeds the maximum

const elements = page.structureElements();
if (elements) {
for (const element of elements) {
console.log(element.type);
}
}

transformAnnotations(matrix): void

Defined in: src/document/page.ts:470

Transform all annotations on the page.

Applies an affine transformation matrix to all annotations.

ParameterTypeDescription
matrixTransformMatrixThe transformation matrix to apply

void


transformWithClip(matrix, clipRect?): boolean

Defined in: src/document/page.ts:1598

Transform this page with a matrix and optional clip rectangle.

ParameterTypeDescription
matrixTransformMatrixThe transformation matrix to apply
clipRect?PageBoxOptional clip rectangle in page coordinates

boolean

True if successful