Skip to content

PDFiumPage

@scaryterry/pdfium


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

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:1110

Get the number of annotations on this page.

number


get artBox(): PageBox | undefined

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

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:456

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:490

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:2223

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:445

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:74

Whether this resource has been disposed.

boolean

Disposable.disposed


get height(): number

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

Get the height of the page in points.

number

IPageReader.height


get index(): number

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

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:434

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:1062

Get the number of objects on this page.

number


get rotation(): PageRotation

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

Get the page rotation as stored in the PDF.

PageRotation

set rotation(rotation): void

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

Set the page rotation.

ParameterTypeDescription
rotationPageRotationThe rotation value to set

void

Page rotation.

IPageReader.rotation


get size(): PageSize

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

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

PageSize

Page dimensions.

IPageReader.size


get trimBox(): PageBox | undefined

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

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:2900

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:311

Get the width of the page in points.

number

IPageReader.width

[dispose](): void

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

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:1201

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>


applyRedactions(options): ApplyRedactionsResult

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

Apply all pending redactions by removing overlapping page content.

This performs destructive content redaction:

  • removes page objects overlapping redaction regions
  • optionally removes intersecting annotations
  • inserts opaque fill rectangles into page content for visual redaction marks

After applying, the page content stream is regenerated.

ParameterType
optionsApplyRedactionsOptions

ApplyRedactionsResult


canFormRedo(): boolean

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

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

boolean


canFormUndo(): boolean

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

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

boolean


createAnnotation(type): PDFiumAnnotation | null

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

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:1699

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:3189

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:179

Alias for Symbol.dispose for explicit calls.

void

document.dispose();

Disposable.dispose


executePageAction(actionType): void

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

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:2009

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:1599

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:1492

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:1447

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:1395

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:1462

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:1477

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:1412

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:1353

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:1430

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:1371

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:1333

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:1549

Select all text in the currently focused form field.

boolean

True if successful


formUndo(): boolean

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

Undo the last form field editing operation on this page.

boolean

True if undo was successful


generateContent(): boolean

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

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:1125

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:1177

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:2462

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:2325

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:2031

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:2423

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:2289

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:2253

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:2271

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:2077

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:2049

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:2345

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:2307

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:2441

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:2235

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:612

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:1941

Get the focusable annotation subtypes.

AnnotationType[]

Array of focusable annotation types


getFocusableSubtypesCount(): number

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

Get the count of focusable annotation subtypes.

number

The number of focusable subtypes


getFormFieldTypeAtPoint(x, y): FormFieldType | null

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

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:1241

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:1505

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:1254

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:2819

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:2890

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:2839

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:1103

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:356

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:627

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:2526

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:1039

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:2100

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:2150

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:2150
textstringsrc/document/page.ts:2150

getThumbnailAsBitmap(): RenderResult | undefined

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

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:2921

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:2405

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:540

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:1613

Check if this page contains transparency.

boolean

True if the page contains transparency


isAnnotationObjectSubtypeSupported(subtype): boolean

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

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:1903

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:2365

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:2385

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:1578

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:2856

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:1079

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:3242

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:1749

Remove an annotation from this page.

ParameterTypeDescription
indexnumberZero-based annotation index

boolean

True if successful


removeObject(obj): boolean

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

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:641

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:1282

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:1533

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:1680

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:1978

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:1564

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:405

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:762

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:2573

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:522

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:1650

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