ApplyPageHeaderFooterSet

Page layout, Pagination, HTML text

Description

Applies a named header and footer set to a page range with first-page and physical-page-parity selection

Syntax

Delphi

Function TPDFlib.ApplyPageHeaderFooterSet(Const SetName,
  PageRange: WideString): Integer;

ActiveX

Function PDFlib::ApplyPageHeaderFooterSet(SetName As String,
  PageRange As String) As Long

DLL

int DLApplyPageHeaderFooterSet(int InstanceID, const wchar_t* SetName,
  const wchar_t* PageRange);
int DLApplyPageHeaderFooterSetA(int InstanceID, const char* SetName,
  const char* PageRange);

Parameters

SetNameCase-insensitive name previously registered with SetPageHeaderFooterVariant
PageRangePage-range expression, or an empty string for every page

Return values

Returns the number of non-empty header and footer elements drawn, or 0 when the set or range has no applicable content or the current API scope cannot change pages

Remarks

For each header and footer role, the first page returned by the range uses first when defined; later pages use odd or even according to their physical page number, and missing specific variants fall back to default

An explicitly defined empty variant draws nothing and prevents fallback, which supports blank first pages

Every template is expanded against its target page before measurement, and HTML variants use the expanded markup for automatic height calculation

Generated content is marked as a pagination artifact and the caller's selected page, font, painter state, and kerning setting are restored

Example

PDF.SetPageHeaderFooterVariant('manual', 'default',
  '<b>Manual</b> — <%PageNo%>/<%TotalPages%>', 36, 0, 0.8, 2, 0, 1);
if PDF.ApplyPageHeaderFooterSet('manual', '3-20')= 0 then
  HandleLayoutError;