ResolvePageNumberPlaceholders

Page layout, Pagination, Text

Description

Expands and draws every deferred page-number placeholder using the final page structure

Syntax

Delphi

Function TPDFlib.ResolvePageNumberPlaceholders: Integer;

ActiveX

Function PDFlib::ResolvePageNumberPlaceholders() As Long

DLL

int DLResolvePageNumberPlaceholders(int InstanceID);

Return values

Returns the number of placeholder text boxes drawn, or 0 when none are pending, pagination was already resolved, a recorded page no longer exists, or text preparation is rejected by the configured missing-glyph policy

Remarks

The method prepares every expanded string before drawing, then revisits the recorded pages and restores each captured painter state

The caller's selected page, selected font, painter state, and kerning setting are restored after the second pass

Resolution is immutable for the document and later chapter or placeholder registration returns 0, preventing accidental duplicate content

Example

PDF.StartPageNumberChapter('Chapter 1');
PDF.AddPageNumberPlaceholder(36, 760, 220, 18,
  'Page <%PageNo%> of <%TotalPages%> — <%ChapterPageNo%>/<%ChapterTotalPages%>', 0);

// Add every remaining page and chapter before the second pass
if PDF.ResolvePageNumberPlaceholders= 0 then
  HandlePaginationError;