PDFium Delphi Component Docs

TextSnapshotCacheCapacity property

Component: TPdf  ·  Unit: PDFium
Sets how many complete text page snapshots the text snapshot cache retains for reuse

Syntax

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

Description

Reading TextPageSnapshot captures page text, per-character records, and text object records with default budgets. The cache keeps one slot per document page and retains completed snapshots in least-recently-used order up to this capacity, so repeated text extraction, structured text reads, and reading-order passes reuse one capture

Each retained snapshot is measured with an estimate covering the snapshot record, the page text, character and text object arrays, and font name strings, and reserves that estimate in the shared CacheBudgetBytes governor

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

Remarks

Setting the capacity to zero clears the cache and disables retention, while direct bounded reads through TextPageSnapshot and ReadTextPageSnapshot keep working and simply re-capture every time

Negative values raise EPdfError

An incomplete capture, one whose Status.Completed is False because a character, text object, or font name budget was hit, is returned to the caller but never cached

Example

Pdf.TextSnapshotCacheCapacity := 16;
Snapshot := Pdf.TextPageSnapshot[PageNumber];
LogSnapshotText(Snapshot.Text);

See Also

TextSnapshotCacheCount, TextSnapshotCacheHitCount, TextPageSnapshot, CacheBudgetBytes, TextPageSnapshots