PDFium Delphi Component Docs

InsertObjectAtIndex method

Component: TPdf  ·  Unit: PDFium
Insert a page object at a chosen position in the drawing order instead of appending it on top

Syntax

procedure InsertObjectAtIndex(StackIndex: Integer; PageObj: Pointer);

StackIndexInteger. Zero-based position in the content stream where the object is placed. Objects at or after this position move up by one
PageObjPointer. Handle of a page object created but not yet inserted, such as the handle returned by ObjectHandle for an object detached with RemoveObject

Description

Page objects paint in content-stream order, so the last object drawn wins where objects overlap. Appending always puts new content on top; this method places it at any depth, which is what a caller needs to slide a watermark underneath existing text or to restack an object that was removed and re-added

The page takes ownership of the object, also when the call raises an exception, for example for an out-of-range index; do not destroy the object afterwards. Passing nil is ignored, as is a call on a PDFium build that does not export the underlying entry point, so the method is safe to call unconditionally

The cached text page is dropped and the page is marked as modified. Call UpdatePage before saving so the edited content stream is regenerated

Saved paragraph metadata

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

See Also

RemoveObject, ObjectHandle, ObjectCount, UpdatePage