TPDFlibWatermarkBase

Data types, page layout

Description

TPDFlibWatermarkBase is the abstract base class for watermarks passed to ApplyWatermark. It holds the placement, rotation, opacity and page range shared by every watermark kind, and declares the Apply method that each concrete subclass overrides to draw itself

The library ships three concrete subclasses: TPDFlibTextWatermark for text, TPDFlibImageWatermark for images, and TPDFlibShapeWatermark for vector shapes

Syntax

Delphi

TPDFlibWatermarkBase = Class
  Public
    Position: TPDFlibWatermarkPosition;
    X, Y: Double;
    Angle: Double;
    Opacity: Double;
    PageRange: WideString;
    Constructor Create; Virtual;
    Function Apply(Lib: TObject): Integer; Virtual; Abstract;
  End;

Fields

PositionThe placement preset from TPDFlibWatermarkPosition; wpCustom uses X and Y directly
X, YThe absolute top-left coordinates used when Position is wpCustom
AngleThe rotation in degrees, where 0 is horizontal
OpacityThe alpha in the range 0 to 1, where 1 is fully opaque
PageRangeThe page range to stamp; an empty string means all pages

Return value

Apply returns the number of pages the watermark was placed on

Remarks

Concrete subclasses add their own fields: TPDFlibTextWatermark adds Text, FontID, FontSize and R, G, B; TPDFlibImageWatermark adds ImageID, Width and Height; TPDFlibShapeWatermark adds the shape geometry

Callers construct a subclass instance, set its fields, then pass it to ApplyWatermark; the facade resolves Position against each page size before drawing

See also

ApplyWatermark