Skip to content

PDFiumTextObject

@scaryterry/pdfium


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

Text object on a PDF page.

Provides access to text content, font size, render mode, and font information.

for (const obj of page.objects()) {
if (obj instanceof PDFiumTextObject) {
console.log(obj.text, obj.fontSize);
using font = obj.getFont();
if (font) console.log(font.familyName);
}
}

get bounds(): Rect

Defined in: src/document/page-object.ts:99

Bounding box in page coordinates (points, origin at bottom-left).

Rect

PDFiumPageObject.bounds


get dashPattern(): DashPattern | null

Defined in: src/document/page-object.ts:158

Get the dash pattern of this page object.

DashPattern | null

PDFiumPageObject.dashPattern


get fillColour(): Colour | null

Defined in: src/document/page-object.ts:104

Get the fill colour of this page object.

Colour | null

PDFiumPageObject.fillColour


get fontSize(): number

Defined in: src/document/page-object.ts:368

Font size in points.

number


get hasClipPath(): boolean

Defined in: src/document/page-object.ts:194

Whether this page object has a clip path applied.

boolean

PDFiumPageObject.hasClipPath


get hasTransparency(): boolean

Defined in: src/document/page-object.ts:176

Check if this page object has transparency.

boolean

PDFiumPageObject.hasTransparency


get lineCap(): LineCapStyle

Defined in: src/document/page-object.ts:134

Get the line cap style of this page object.

LineCapStyle

PDFiumPageObject.lineCap


get lineJoin(): LineJoinStyle

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

Get the line join style of this page object.

LineJoinStyle

PDFiumPageObject.lineJoin


get markCount(): number

Defined in: src/document/page-object.ts:238

Get the number of content marks on this page object.

number

PDFiumPageObject.markCount


get marks(): PageObjectMark[]

Defined in: src/document/page-object.ts:263

Get all content marks from this page object.

PageObjectMark[]

PDFiumPageObject.marks


get matrix(): TransformMatrix | null

Defined in: src/document/page-object.ts:122

Get the transformation matrix of this page object.

TransformMatrix | null

PDFiumPageObject.matrix


get renderMode(): TextRenderMode | null

Defined in: src/document/page-object.ts:373

Get the text render mode.

TextRenderMode | null


get rotatedBounds(): QuadPoints | null

Defined in: src/document/page-object.ts:188

Get the rotated bounding box of this page object as quad points.

QuadPoints | null

PDFiumPageObject.rotatedBounds


get strokeColour(): Colour | null

Defined in: src/document/page-object.ts:110

Get the stroke colour of this page object.

Colour | null

PDFiumPageObject.strokeColour


get strokeWidth(): number | null

Defined in: src/document/page-object.ts:116

Get the stroke width of this page object.

number | null

PDFiumPageObject.strokeWidth


get text(): string

Defined in: src/document/page-object.ts:363

The text content.

string


get type(): PageObjectType

Defined in: src/document/page-object.ts:94

The type of this page object.

PageObjectType

PDFiumPageObject.type

addMark(name): PageObjectMark | null

Defined in: src/document/page-object.ts:282

Add a content mark to this page object.

ParameterTypeDescription
namestringThe mark name (e.g., ‘Artifact’, ‘Span’)

PageObjectMark | null

The mark data, or null if failed

PDFiumPageObject.addMark


destroy(): void

Defined in: src/document/page-object.ts:227

Destroy this page object and free its underlying resources.

Page objects are borrowed views — they do not own the underlying handle and become invalid when the parent page is disposed.

Only call this for page objects that have NOT been inserted into a page. Once an object is added to a page via builder methods, it is owned by the page and must not be destroyed manually.

After calling destroy(), any further access to this object’s properties or methods will throw.

void

PDFiumPageObject.destroy


getFont(): PDFiumFont | null

Defined in: src/document/page-object.ts:390

Get the font of this text object.

Returns a PDFiumFont that retains the parent page’s native resources. Dispose the font when done (or use the using keyword).

PDFiumFont | null


getMark(index): PageObjectMark | null

Defined in: src/document/page-object.ts:249

Get a content mark by index.

ParameterTypeDescription
indexnumberZero-based mark index

PageObjectMark | null

The mark information, or null if not found

PDFiumPageObject.getMark


removeMark(index): boolean

Defined in: src/document/page-object.ts:298

Remove a content mark from this page object by index.

ParameterTypeDescription
indexnumberZero-based mark index

boolean

True if successful

PDFiumPageObject.removeMark


setBlendMode(blendMode): void

Defined in: src/document/page-object.ts:182

Set the blend mode of this page object.

ParameterType
blendModeBlendMode

void

PDFiumPageObject.setBlendMode


setDashPattern(pattern): boolean

Defined in: src/document/page-object.ts:164

Set the dash pattern of this page object.

ParameterType
patternDashPattern

boolean

PDFiumPageObject.setDashPattern


setDashPhase(phase): boolean

Defined in: src/document/page-object.ts:170

Set the dash phase of this page object.

ParameterType
phasenumber

boolean

PDFiumPageObject.setDashPhase


setLineCap(lineCap): boolean

Defined in: src/document/page-object.ts:140

Set the line cap style of this page object.

ParameterType
lineCapLineCapStyle

boolean

PDFiumPageObject.setLineCap


setLineJoin(lineJoin): boolean

Defined in: src/document/page-object.ts:152

Set the line join style of this page object.

ParameterType
lineJoinLineJoinStyle

boolean

PDFiumPageObject.setLineJoin


setMatrix(matrix): boolean

Defined in: src/document/page-object.ts:128

Set the transformation matrix of this page object.

ParameterType
matrixTransformMatrix

boolean

PDFiumPageObject.setMatrix


setRenderMode(mode): boolean

Defined in: src/document/page-object.ts:379

Set the text render mode.

ParameterType
modeTextRenderMode

boolean


transformClipPath(matrix): void

Defined in: src/document/page-object.ts:200

Transform the clip path of this page object.

ParameterType
matrixTransformMatrix

void

PDFiumPageObject.transformClipPath