ReconcileStructParentTree

Tagged PDF, structure repair

Description

Rebuilds the document ParentTree, ParentTreeNextKey, IDTree, and object StructParent/StructParents keys from the normalised structure tree

Syntax

Delphi

Function TPDFlib.ReconcileStructParentTree(Mode: Integer= 0): Integer;

Parameters

Mode0 for strict validation (fails on conflicting MCID/OBJR owners, missing /S, or duplicate /ID without mutating ParentTree), or 1 to repair conflicts by keeping the first owner and detaching duplicate claims

Return values

1 when reconciliation completes cleanly, or 0 when strict checks fail or no structure tree exists

Remarks

Updates page /StructParents, Form stream /StructParents, and OBJR annotation /StructParent keys atomically and strips stale StructParent/StructParents keys from unreferenced pages and annotations