function InspectOptionalContent(out Inventory: TPdfOptionalContentInventory;
Usage: TPdfOptionalContentUsage = ocuView;
ConfigurationIndex: Integer = -1): Boolean;
The method asks PDFium to save the current in-memory document state, then reads the resulting active object graph without depending on private renderer exports
Groups contains object identities, names, Intent values, View/Print/Export states, language and preferred-language metadata, page-element subtype, zoom range, lock state, radio-group membership, and effective visibility
Configurations contains the default configuration followed by alternate configurations, including names, creators, Intent values, /BaseState, /ON, /OFF, /Locked, flattened /Order, /RBGroups, and automatic-state presence
Memberships reports indirect OCMD dictionaries, member groups, policy, original /VE expression text, and the evaluated result with recursion bounded at 32 levels
Inventory receives all discovered records, the selected configuration index, success state, and diagnostic textUsage selects View, Print, Export, or Design semantics for effective visibilityConfigurationIndex is zero-based; pass -1 to select the default configuration at index 0TPdf is not modified and the staging stream follows SaveMemoryLimit spill policy/OCProperties returns False with a descriptive ErrorMessagevar
Inventory: TPdfOptionalContentInventory;
begin
if Pdf1.InspectOptionalContent(Inventory, ocuView) then
Caption := Inventory.Groups[0].Name;
end;