API referenceCore SDK

pdfLoadHeaderFooterSettings

Acrobat-style headers/footers: up to six independent text

C
BOOL32 __stdcall pdfAddHeaderFooter(PPDF IPDF, struct TPDFHeaderFooter* Init, struct TPDFHdrFtr* HFArray, uint32_t Count);
BOOL32 __stdcall pdfInitHeaderFooter(struct TPDFHeaderFooter* Init, struct TPDFHdrFtr* HFArray, uint32_t Count);
int32_t __stdcall pdfLoadHeaderFooterSettings(PPDF IPDF, struct TPDFHeaderFooter* Init, struct TPDFHdrFtr* HFArray);
Delphi
function pdfAddHeaderFooter(const IPDF: PPDF; Init: PPDFHeaderFooter; HFArray: PPDFHdrFtr; Count: Cardinal): LongBool; stdcall;
function pdfInitHeaderFooter(Init: PPDFHeaderFooter; HFArray: PPDFHdrFtr; Count: Cardinal): LongBool; stdcall;
function pdfLoadHeaderFooterSettings(const IPDF: PPDF; Init: PPDFHeaderFooter; HFArray: PPDFHdrFtr): Integer; stdcall;

Purpose. Acrobat-style headers/footers: up to six independent text zones (header/footer x left/center/right) stamped across a page range, with placeholder expansion for bates numbers, dates, and page numbers.

Description. Initialize a TPDFHeaderFooter (set StructSize, call pdfInitHeaderFooter — defaults: hffDefault flags, black, Helvetica 8 pt, cp1252) and fill up to 6 TPDFHdrFtr records; IsHeader + Position (taLeft/taCenter/taRight) select the zone, duplicates are rejected. pdfAddHeaderFooter stamps every page in FirstPage..LastPage honoring the even/odd flags; text is placed on the baseline at the Margin distances (headers hang above the top-margin line — at margin [0,0,0,0] header text sits outside the visible area). A record with a font must also set FontSize; with a global Init font a record font applies to that record only. Placeholders inside << >>: <<Bates#6#100>> (zero-padded, advances per stamped page), <<yyyy-mm-dd>>-style dates, and page numbers where a digit run gets the 0-based page index added and an escaped n becomes the page count (<<Page 1 of n>>). Unrecognized snippets print verbatim.

The definitions are also persisted (catalog /PieceInfo), so pdfLoadHeaderFooterSettings can read them back from an imported file into Init plus a 6-record array in natural order (header L/C/R = 0..2, footer L/C/R = 3..5; loaded strings are returned as Unicode — Codepage = cpUnicode — or UTF-8 when hffLoadUTF8 is set). With hffSearchRun it only reports what the file contains: 0 none, 32 bates numbers, 64 headers/footers, 96 both. Settings written by other producers (e.g. Adobe Acrobat) are not currently recognized.

Parameters.

ParameterDescription
IPDFDocument handle.
InitGlobal settings record; StructSize must be sizeof(TPDFHeaderFooter).
HFArrayArray of header/footer records (up to 6; exactly 6 for Load).
CountNumber of records in HFArray.

Return value. pdfAddHeaderFooter/pdfInitHeaderFooter: True on success. pdfLoadHeaderFooterSettings: the number of filled records, the hffSearchRun bit mask described above, or a negative value on error.

See also. pdfSetPageHeader / pdfSetPageFooter (the simpler running-header mechanism).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfLoadHeaderFooterSettings(IntPtr IPDF, IntPtr Init, IntPtr HFArray);
Area
Core SDK
Category

Core

Exported names

pdfLoadHeaderFooterSettings

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.