SetPageHeaderFooterVariant

Page layout, Pagination, HTML text

Description

Creates or replaces one variant in a named reusable running-header and footer set

Syntax

Delphi

Function TPDFlib.SetPageHeaderFooterVariant(Const SetName, VariantName,
  Text: WideString; Margin, Height, Opacity: Double; Alignment,
  IsHeader, RichText: Integer): Integer;

ActiveX

Function PDFlib::SetPageHeaderFooterVariant(SetName As String,
  VariantName As String, Text As String, Margin As Double,
  Height As Double, Opacity As Double, Alignment As Long,
  IsHeader As Long, RichText As Long) As Long

DLL

int DLSetPageHeaderFooterVariant(int InstanceID, const wchar_t* SetName,
  const wchar_t* VariantName, const wchar_t* Text, double Margin,
  double Height, double Opacity, int Alignment, int IsHeader, int RichText);
int DLSetPageHeaderFooterVariantA(int InstanceID, const char* SetName,
  const char* VariantName, const char* Text, double Margin,
  double Height, double Opacity, int Alignment, int IsHeader, int RichText);

Parameters

SetNameCase-insensitive name shared by variants that belong to one template set
VariantNamedefault, first, odd, or even, matched case-insensitively
TextText or HTML template expanded separately for every selected page; an empty value creates an explicit blank variant that suppresses fallback
MarginNon-negative distance from the relevant page edge
HeightContent-box height, or 0 to measure the plain text line or HTML content automatically
OpacityValue from 0 for transparent through 1 for opaque
Alignment0 for left, 1 for centre, or 2 for right
IsHeader1 for a header or 0 for a footer
RichText1 to render Text as HTML or 0 to use the currently selected font and painter state

Return values

Returns 1 when the variant was stored, or 0 when a name, variant, numeric value, alignment, or flag is invalid

Remarks

A later call with the same set name, variant name, and header or footer role replaces the existing definition

Templates support the same ampersand and <%name%> fields as AddPageHeader, including custom variables resolved by OnCalcVariable

Definitions belong to the TPDFlib instance and can be applied to more than one document

Example

PDF.SetPageHeaderFooterVariant('manual', 'first', '', 36, 0, 1, 0, 1, 0);
PDF.SetPageHeaderFooterVariant('manual', 'odd', 'Chapter — <%PageNo%>', 36, 0, 1, 2, 1, 0);
PDF.SetPageHeaderFooterVariant('manual', 'even', '<%PageNo%> — Chapter', 36, 0, 1, 0, 1, 0);