|
THPDFPage.AddTextWatermark Method
Syntax
procedure AddTextWatermark(
const Text : WideString;
X, Y : Single;
Angle : Extended;
Opacity : Single;
const FontName: AnsiString;
FontStyle : TFontStyles;
FontSize : Single;
Color : TColor);
Description
AddTextWatermark draws rotated transparent text on the
current page. It registers an ExtGState with matching fill and stroke
alpha, saves the current graphics state, applies the watermark font and
fill color, emits the text, and restores the previous graphics state.
Opacity is clamped to the range 0..1.
Values below 1 require PDF transparency support and are
rejected by the same PDF/A and PDF/X profile gates used by
RegisterExtGState. Use this method on generated pages or
on pages selected after LoadFromFile and
BeginDoc.
Example
PDF.LoadFromFile('Input.pdf');
PDF.FileName := 'Watermarked.pdf';
PDF.BeginDoc;
for I := 0 to PDF.PagesCount - 1 do
begin
PDF.CurrentPageNumber := I;
PDF.CurrentPage.AddTextWatermark(
'CONFIDENTIAL', 105, 430, -35, 0.22, 'Arial', [fsBold], 56, clSilver);
end;
PDF.EndDoc;
See Also
|