PDFium Delphi Component Docs

Cached layout nodes

Komponen: TPdf  ·  Unit: FPdfLayout

Syntax

procedure TPdfLayoutDocument.AddCachedNode(Node: TPdfLayoutCachedNode; Height: Single = 0; Width: Single = 0);

Measurement cache

BuildPlan caches the complete measured plan by page constraints, item content, font, style, source identity, reserved page digits, and TPdfLayoutMeasurer.CacheIdentity

A matching call returns without measuring text again and reports the result through CacheHitCount; changed content produces CacheMissCount and replaces the snapshot

Call InvalidateCache to release the stored snapshot or when a custom measurer keeps one identity while changing behaviour

Lazy nodes

Derive from TPdfLayoutCachedNode and override BuildContent to create the node layout only on its first placement

A base node can also be populated directly through Content

The caller owns each node and must keep it alive until GenerateLayout returns

Native reuse

The first placement renders one private single-page layout and creates one destination-bound XObject with FPDF_NewXObjectFromPage

Every repeated placement creates a lightweight Form object from that same XObject, while ReusedXObjectCount reports the avoided template builds

Safety

Node content must fit on one page whose dimensions match the node constructor

Recursive node references are rejected and the outer append transaction rolls back all pages created by the call

Call Invalidate to rebuild an overridden lazy node after its external inputs change

See Also

GenerateLayout, CreateXObjectFromPage