ReparentStructTreeCursor

Tagged PDF, structure repair

Description

Moves the cursor element below a new parent or reorders it within the same parent. The method normalizes the tree first, verifies both elements are reachable, rejects self-parenting and descendant cycles, updates the parent child collection, and writes the matching child /P link

Syntax

Delphi

Function TPDFlib.ReparentStructTreeCursor(CursorID, NewParentCursorID, ChildIndex: Integer): Integer;

ActiveX

Function PDFlib::ReparentStructTreeCursor(CursorID As Long, NewParentCursorID As Long, ChildIndex As Long) As Long

DLL

int DLReparentStructTreeCursor(int InstanceID, int CursorID, int NewParentCursorID, int ChildIndex);

Parameters

NewParentCursorIDA structure-element cursor, or 0 for the structure-tree root
ChildIndexOne-based position among structure-element children, or 0 to append after existing kids

Return values

The moved element's new positive item index, or 0 when validation fails

Remarks

Integer MCIDs, /MCR, and /OBJR kids keep their relative order and are not counted by ChildIndex. Moving a hierarchy node does not alter marked-content ownership or parent-tree values