AddPageFooter

Page Manipulation, Annotations

Description

Stamps a running footer line on one or more pages of the selected document. The text is drawn in overlay mode with the currently selected font, stamp tokens such as <%PageNo%> are expanded against each target page before the line is measured, and the stamped line is enclosed in a Pagination artifact with subtype Footer so tagged-PDF readers treat it as page furniture rather than repeating content

Syntax

Delphi

Function TPDFlib.AddPageFooter(Const PageRange, Text: WideString;
  Margin, Opacity: Double; Alignment: Integer): Integer;

Parameters

PageRangePage-range expression, or an empty string for every page
TextFooter text; the tokens understood by ExpandStampTokens expand against each target page
MarginDistance from the bottom edge of the page to the footer line, in PDF points
OpacityText opacity between 0 and 1, where 1 draws fully opaque
Alignment0 aligns left at the margin, 1 centres between the margins, 2 aligns right and keeps the margin distance from the right edge

Return values

The number of pages on which the footer was stamped, or 0 when no document is selected, Text is empty, or no page of the range could be selected

Remarks

The line is measured with the current font and size, so call SelectFont first; content already on the page stays visible underneath the overlay. The selected page is restored when the call returns

For first-page, odd-page, and even-page footer roles with HTML content support see ApplyPageHeaderFooterSet

Example

PDF.SelectFont(PDF.AddStandardFont(sfHelvetica));
PDF.AddPageFooter('', '<%ShortDate%> - <%PageNo%>/<%TotalPages%>', 24, 0.8, 2);