Skip to content

NativePDFiumPage

@scaryterry/pdfium


Defined in: src/document/native-page.ts:66

A PDF page backed by the native PDFium addon.

Supports core operations: dimensions, text extraction, and rendering.

get annotationCount(): number

Defined in: src/document/native-page.ts:535

Get the number of annotations on this page.

number


get artBox(): PageBox | undefined

Defined in: src/document/native-page.ts:521

Get the art box (content boundaries).

PageBox | undefined


get bleedBox(): PageBox | undefined

Defined in: src/document/native-page.ts:511

Get the bleed box (printing bleed area).

PageBox | undefined


get charCount(): number

Defined in: src/document/native-page.ts:146

Get the number of characters on the page.

number


get cropBox(): PageBox | undefined

Defined in: src/document/native-page.ts:506

Get the crop box (visible region).

PageBox | undefined


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/native-page.ts:119

Get the height of the page in points.

number


get index(): number

Defined in: src/document/native-page.ts:102

The zero-based index of this page.

number


get mediaBox(): PageBox | undefined

Defined in: src/document/native-page.ts:501

Get the media box (physical page boundaries).

PageBox | undefined


get rotation(): PageRotation

Defined in: src/document/native-page.ts:410

Get the page rotation (0=0deg, 1=90deg, 2=180deg, 3=270deg).

PageRotation


get size(): object

Defined in: src/document/native-page.ts:107

Get the page dimensions in points.

object

NameTypeDefined in
heightnumbersrc/document/native-page.ts:107
widthnumbersrc/document/native-page.ts:107

get trimBox(): PageBox | undefined

Defined in: src/document/native-page.ts:516

Get the trim box (final trimmed dimensions).

PageBox | undefined


get width(): number

Defined in: src/document/native-page.ts:113

Get the width of the page in points.

number

[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

Disposable.[dispose]


appendAnnotationAttachmentPoints(index, points): boolean

Defined in: src/document/native-page.ts:664

Append attachment points to an annotation.

ParameterType
indexnumber
pointsQuadPoints

boolean

true if the points were appended.


createAnnotation(subtype): number

Defined in: src/document/native-page.ts:546

Create a new annotation on this page.

ParameterTypeDescription
subtypeAnnotationTypeAnnotation subtype (e.g. AnnotationType.Text = 1).

number

The index of the new annotation.


deviceToPage(context, deviceX, deviceY): PageCoordinate

Defined in: src/document/native-page.ts:440

Convert device coordinates to page coordinates.

ParameterType
contextCoordinateTransformContext
deviceXnumber
deviceYnumber

PageCoordinate


dispose(): void

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

Alias for Symbol.dispose for explicit calls.

void

document.dispose();

Disposable.dispose


findText(query, flags): IterableIterator<TextSearchResult>

Defined in: src/document/native-page.ts:386

Find all occurrences of a string on the page.

ParameterTypeDefault value
querystringundefined
flagsTextSearchFlagsTextSearchFlags.None

IterableIterator<TextSearchResult>


flatten(flags): FlattenResult

Defined in: src/document/native-page.ts:422

Flatten annotations and form fields into page content.

ParameterTypeDefault value
flagsFlattenFlagsFlattenFlags.NormalDisplay

FlattenResult


generateContent(): boolean

Defined in: src/document/native-page.ts:432

Generate the page content stream after modifications.

boolean


getAnnotationFlags(index): number

Defined in: src/document/native-page.ts:600

Get the flags of an annotation.

ParameterType
indexnumber

number


getAnnotations(): Annotation[]

Defined in: src/document/native-page.ts:528

Get all annotations on this page.

Annotation[]


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

Defined in: src/document/native-page.ts:401

Get text within a bounding rectangle.

ParameterType
leftnumber
topnumber
rightnumber
bottomnumber

string


getCharAngle(charIndex): number

Defined in: src/document/native-page.ts:284

Get the rotation angle (in radians) of a character.

ParameterType
charIndexnumber

number


getCharBox(charIndex): CharBox | undefined

Defined in: src/document/native-page.ts:306

Get the bounding box of a character.

ParameterType
charIndexnumber

CharBox | undefined


getCharFillColour(charIndex): Colour | undefined

Defined in: src/document/native-page.ts:340

Get the fill colour of a character.

ParameterType
charIndexnumber

Colour | undefined


getCharFontName(charIndex): string | undefined

Defined in: src/document/native-page.ts:210

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

ParameterType
charIndexnumber

string | undefined


getCharFontSize(charIndex): number

Defined in: src/document/native-page.ts:184

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

ParameterType
charIndexnumber

number


getCharFontWeight(charIndex): number

Defined in: src/document/native-page.ts:197

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

ParameterType
charIndexnumber

number


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

Defined in: src/document/native-page.ts:328

Get the character index at a page position. Returns -1 if not found.

ParameterTypeDefault value
xnumberundefined
ynumberundefined
xTolerancenumberDEFAULT_CHAR_POSITION_TOLERANCE
yTolerancenumberDEFAULT_CHAR_POSITION_TOLERANCE

number


getCharLooseBox(charIndex): Rect | undefined

Defined in: src/document/native-page.ts:317

Get the loose bounding box of a character.

ParameterType
charIndexnumber

Rect | undefined


getCharMatrix(charIndex): TransformMatrix | undefined

Defined in: src/document/native-page.ts:362

Get the transformation matrix of a character.

ParameterType
charIndexnumber

TransformMatrix | undefined


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

Defined in: src/document/native-page.ts:295

Get the origin point of a character.

ParameterType
charIndexnumber

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


getCharRenderMode(charIndex): TextRenderMode

Defined in: src/document/native-page.ts:224

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

ParameterType
charIndexnumber

TextRenderMode


getCharStrokeColour(charIndex): Colour | undefined

Defined in: src/document/native-page.ts:351

Get the stroke colour of a character.

ParameterType
charIndexnumber

Colour | undefined


getCharUnicode(charIndex): number

Defined in: src/document/native-page.ts:240

Get the Unicode codepoint of a character.

ParameterType
charIndexnumber

number


getLinks(): PDFLink[]

Defined in: src/document/native-page.ts:693

Get all links on this page.

PDFLink[]


getPageBox(boxType): PageBox | undefined

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

Get a specific page box by type.

ParameterType
boxTypePageBoxType

PageBox | undefined


getText(): string

Defined in: src/document/native-page.ts:125

Get all text content from the page.

string


hasCharUnicodeMapError(charIndex): boolean

Defined in: src/document/native-page.ts:273

Check if a character has a Unicode mapping error.

ParameterType
charIndexnumber

boolean


hasTransparency(): boolean

Defined in: src/document/native-page.ts:416

Check if this page contains transparency.

boolean


isCharGenerated(charIndex): boolean

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

Check if a character is generated (not from the original PDF content).

ParameterType
charIndexnumber

boolean


isCharHyphen(charIndex): boolean

Defined in: src/document/native-page.ts:262

Check if a character is a hyphen.

ParameterType
charIndexnumber

boolean


pageToDevice(context, pageX, pageY): DeviceCoordinate

Defined in: src/document/native-page.ts:458

Convert page coordinates to device coordinates.

ParameterType
contextCoordinateTransformContext
pageXnumber
pageYnumber

DeviceCoordinate


removeAnnotation(index): boolean

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

Remove an annotation by index.

ParameterType
indexnumber

boolean

true if the annotation was removed.


render(options): RenderResult

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

Render the page to a bitmap.

ParameterType
optionsRenderOptions

RenderResult


setAnnotationAttachmentPoints(index, quadIndex, points): boolean

Defined in: src/document/native-page.ts:642

Set attachment points at a specific quad index.

ParameterType
indexnumber
quadIndexnumber
pointsQuadPoints

boolean

true if the points were set.


setAnnotationBorder(index, horizontalRadius, verticalRadius, borderWidth): boolean

Defined in: src/document/native-page.ts:632

Set the border of an annotation.

ParameterType
indexnumber
horizontalRadiusnumber
verticalRadiusnumber
borderWidthnumber

boolean

true if the border was set.


setAnnotationColour(index, colour, colourType): boolean

Defined in: src/document/native-page.ts:584

Set the colour of an annotation.

ParameterTypeDefault valueDescription
indexnumberundefined-
colourColourundefined-
colourTypenumber00 for colour, 1 for interior colour.

boolean

true if the colour was set.


setAnnotationFlags(index, flags): boolean

Defined in: src/document/native-page.ts:610

Set the flags of an annotation.

ParameterType
indexnumber
flagsnumber

boolean

true if the flags were set.


setAnnotationRect(index, bounds): boolean

Defined in: src/document/native-page.ts:566

Set the bounding rectangle of an annotation.

ParameterType
indexnumber
boundsPageBox

boolean

true if the rect was set.


setAnnotationStringValue(index, key, value): boolean

Defined in: src/document/native-page.ts:622

Set a string value on an annotation.

ParameterTypeDescription
indexnumber-
keystringThe dictionary key (e.g. “Contents”).
valuestringThe string value.

boolean

true if the value was set.


setAnnotationUri(index, uri): boolean

Defined in: src/document/native-page.ts:685

Set the URI on a link annotation.

ParameterType
indexnumber
uristring

boolean

true if the URI was set.


setPageBox(boxType, box): void

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

Set a specific page box by type.

ParameterType
boxTypePageBoxType
boxPageBox

void