PDFium Delphi Component Docs

GetObjectText method

Component: TPdf  ·  Unit: PDFium
Extract the text drawn by one text object

Syntax

function GetObjectText(Index: Integer): WString;

IndexInteger. Zero-based index of the page object
ResultWString. The text of that object, or an empty string when the object draws no text

Description

Reads text one object at a time, which keeps the extracted run tied to the object that drew it - useful when the caller also needs that object's colour, font, or matrix from PageObjectInfo. Whole-page extraction is what Text is for

The text page is loaded on demand, so no separate preparation call is needed

Objects that are not text objects return an empty string rather than raising

See Also

Text, GetObjectsByType, GetStructuredText, ObjectType