PDFium Delphi Component Docs

GeneratePagedLayout method

Component: TPdf  ·  Units: PDFium, FPdfLayout

Syntax

function GeneratePagedLayout(Layout: TPdfLayoutDocument; PagedPlan: TPdfLayoutPagedPlan; out Plan: TPdfLayoutPlan; AllowSignedDocument: Boolean = False): Boolean;

Description

Measures and paginates the layout whilst serialising each command into the seekable storage owned or referenced by PagedPlan

After measurement, it materialises one page command array at a time, emits that page through the same native PDFium page-object APIs as GenerateLayout, flushes it, releases the local array, and continues with the next page

Storage and cache

Use a dedicated TFileStream, TMemoryStream or TPdfRandomAccessStore; the stream must support seek, read, write, resize and exclusive use for the lifetime of the paged plan

MaxCommandCount, MaxStorageBytes, MaxPageCommands, and MaxSourceCount reject excessive plans, whilst MaxCachedPages bounds the internal LRU cache and may be zero

CommandCount, StorageByteCount, cache counters, and peak occupancy expose measurable behaviour

Result

Plan.Commands is empty by design; page settings, page count, semantic elements, content counts, measurements, and stable page-reference totals remain available

PagedPlan.MaterializePage can restore a complete page later, including body plus separately written header and footer segments

Limitations and safety

This method generates an untagged layout; use GenerateTaggedLayout when a complete in-memory command plan and structure-tree post-processing are required

PDFium retains the authored document and its native pages until save or close, so this API bounds high-level command materialisation rather than PDFium document memory

Any referenced source PDF or TPdfLayoutCachedNode must outlive generation and later materialisation, and signed destinations require explicit authorisation

Measurement or emission failure resets incomplete command storage and rolls back every page appended by the call

See Also

GenerateLayout, GenerateTaggedLayout, FPdfLayout, Random access working storage