PDFium Delphi Component Docs

PageObjectsSnapshot property

Component: TPdf  ·  Unit: PDFium
Returns the cached bounded snapshot of every object on one page as managed records

Syntax

property PageObjectsSnapshot[PageNumber: Integer]: TPdfPageObjectsSnapshot; // read only

 

type TPdfPageObjectsSnapshot = record
  PageNumber: Integer;
  Width: Double;
  Height: Double;
  Status: TPdfPageObjectSnapshotStatus;
  Objects: TPdfPageObjectSnapshots;
end;

PageNumberInteger. One-based page index within the loaded document
StatusTPdfPageObjectSnapshotStatus. Completion flag, visited object counts, and the budget flags that were reached
ObjectsPer-object records with type, bounds, transform, colors, dash arrays, path and clip segments, content marks, image metadata, and bounded text

Description

The first access for a page captures the snapshot with TPdfPageObjectSnapshotOptions.Default budgets. The active page is read through its loaded handles, and any other page is loaded and closed transiently without changing PageNumber or firing OnPageChange

Every access returns a deep copy, so changing nested dash arrays, mark parameters, path segments, clip paths, filters, or strings cannot modify cached data or the document

Completed snapshots are retained in the bounded cache described by PageObjectSnapshotCacheCapacity and measured against CacheBudgetBytes, and PageComplexity reuses this cache for object types, path counts, image pixels, and transparency

Remarks

Calling without an active document raises EPdfError, and a PageNumber outside one through PageCount raises EPdfError with the message Incorrect page number

Use ReadPageObjectsSnapshot for custom capture budgets or to bypass the cache deliberately

Example

Snapshot := Pdf.PageObjectsSnapshot[PageNumber];
for I := 0 to High(Snapshot.Objects) do
  if Snapshot.Objects[I].ObjectType = otImage then
    LogImageObject(I);

See Also

PageObjectSnapshotCacheCapacity, PageObjectSnapshotCacheCount, PageObjectSnapshots, PageObjectInfo, PageComplexity