TPDFlibCompositeWatermark

Data types, page layout

Description

TPDFlibCompositeWatermark is the concrete TPDFlibWatermarkBase subclass that groups child watermarks and applies all of them in one ApplyWatermark call

Add any mix of TPDFlibTextWatermark, TPDFlibImageWatermark and TPDFlibShapeWatermark instances with Add; the composite owns the children and frees them in its destructor

The composite applies every child to the same PageRange; each child keeps its own Position and Opacity settings, and the composite page range is pushed down to children that have an empty page range

Syntax

Delphi

TPDFlibCompositeWatermark = Class(TPDFlibWatermarkBase)
  Public
    Constructor Create; Override;
    Destructor Destroy; Override;
    Procedure Add(Item: TPDFlibWatermarkBase);
    Property Count: Integer Read GetCount;
    Property Items[Index: Integer]: TPDFlibWatermarkBase Read GetItem; Default;
    Function Apply(Lib: TObject): Integer; Override;
  End;

Methods

AddAppends a child watermark; the composite takes ownership
CountNumber of child watermarks held
ItemsAccesses a child by zero-based index; the property is the class default

Return values

Apply returns the total number of placements, that is the sum of the values returned by each child's Apply; when every child stamps every page in the range this is the page count multiplied by the number of children

Remarks

Use a composite when one stamp needs several layers, for example a shape band with centred text on top of the same pages

The composite owns the items passed to Add and frees them with itself. Add ignores nil, an instance that is already part of the composite, and a composite that already contains this one

See also

ApplyWatermark, TPDFlibWatermarkBase, TPDFlibTextWatermark, TPDFlibImageWatermark, TPDFlibShapeWatermark