PDFium Delphi Component Docs

StructureCacheCapacity property

Component: TPdf  ·  Unit: PDFium
Sets how many parsed page structure trees the tagged-structure cache retains for reuse

Syntax

property StructureCacheCapacity: Integer; // read and write, default 8

Description

Reading StructureElementsForPage parses the tagged structure tree of a page into a managed snapshot. The cache keeps one slot per document page and retains completed trees in least-recently-used order up to this capacity, so that repeated accessibility checks and structure traversals skip the native walk

Each retained tree is measured with an estimate covering its element records, strings, identifier arrays and attribute values, and reserves that estimate in the shared CacheBudgetBytes governor

Reducing the capacity evicts the least recently used trees and releases their governor bytes immediately

Remarks

Setting the capacity to zero clears the cache and disables retention, whilst direct reads through StructureElementsForPage and ReadStructureElements keep working and simply re-parse every time

Negative values raise EPdfError

An incomplete traversal, one whose Status.Completed is False because a depth, element, attribute or deadline limit was hit, is returned to the caller but never cached

Example

Pdf.StructureCacheCapacity := 16;
Elements := Pdf.StructureElementsForPage[PageNumber];

See Also

StructureCacheCount, StructureCacheHitCount, StructureElementsForPage, CacheBudgetBytes, StructureTraversal