Compose

Page layout, pagination, Form XObjects

Description

Abstract method of TPDFlibDynamicComponent that draws one fragment of the component in local coordinates and reports its used bounds and continuation state

Syntax

Function TPDFlibDynamicComponent.Compose(
  Const Context: TPDFlibDynamicPageContext;
  Out ComposeResult: TPDFlibDynamicPageResult): Integer;
  Virtual; Abstract;

Parameters

Context.LibraryInstanceAttached TPDFlib instance the fragment shall draw through
Context.PageNumberDestination page number even though the library selects an isolated temporary page while the callback runs
Context.CompositionIndexOne-based number the fragment receives when it commits
Context.DestinationLeft, Context.DestinationTopDestination slot position passed through from the compose call
Context.AvailableWidth, Context.AvailableHeightNatural canvas size of the surrounding Form XObject

Result record

HasContentTrue when the fragment drew visible content
HasMoreContentTrue when the component can produce another fragment
UsedWidth, UsedHeightUsed rectangle that starts at local coordinate zero and shall bound all visible component content

Remarks

Content results require finite positive UsedWidth and UsedHeight values within AvailableWidth and AvailableHeight

A no-content result is valid only when HasMoreContent is False and both used dimensions are zero

The callback may use drawing and content APIs but shall not change documents, pages or nested drawing containers

The session validates ComposeResult through ValidComposeResult before any placement decision is made

Returning zero rejects the attempt without committing component or destination state; raised exceptions propagate after the session has cleaned up temporary state

Return values

1The fragment result is offered for validation and placement
0The attempt is rejected and no component or destination state changes

See also

TPDFlibDynamicComponent, TPDFlibDynamicPageContext, TPDFlibDynamicPageResult, ValidComposeResult, ComposeNextLayout, CloneComponent