procedure SetText(ObjectIndex: Integer; const Text: WString);
Replaces the text content of the text page object at ObjectIndex (0 .. ObjectCount - 1) on the current page
To insert a brand-new text object onto the page, call AddText instead
All edits to the current page are buffered in PDFium's in-memory representation. Call UpdatePage to refresh the rendering cache and SaveAs to persist the changes
ObjectIndex must refer to a text object (ObjectType[ObjectIndex] = otText)UpdatePage after modifying text objects to regenerate the page content stream
begin
if Pdf1.Active and (Pdf1.ObjectCount > 0) and (Pdf1.ObjectType[0] = otText) then
begin
Pdf1.SetText(0, 'Updated text');
Pdf1.UpdatePage;
end;
end;
Since internal v3.403.0, direct logical text, object membership and ActualText changes clear affected saved paragraph cluster tables Geometry, style and metadata-only changes retain tables and regenerate complete represented shared mark scopes across adjacent nonempty streams Mark list membership is local to the selected object, while exact shared declarations keep their identity The bundled DLLs isolate named-property parameter edits; native builds without detachment reject a table-affecting logical change before mutation
Read native character maps again after mutation or reload These low-level operations do not supply reviewed replacement semantics or repair arbitrary tagged ownership Use the batch semantic-edit policies when those values and bindings must be reviewed together See scope, ownership and remaining source-preservation limits