GetPageFontCount

Fonts, page properties

Description

Returns the number of font resources in the resource dictionary of the given page, restoring the previously selected page before it returns. Returns 0 when no document is open or the page number is out of range.

Syntax

Delphi

Function TPDFlib.GetPageFontCount(Page: Integer): Integer;

Parameters

Page is the 1-based number of the page to inspect and must lie in 1..PageCount; the page does not have to be the selected one, because the function selects it internally and restores the previous selection before returning.

Return values

The number of entries in the page's /Resources /Font dictionary, or 0 when no document is open, the page number is out of range, or the page declares no font resource — so 0 cannot be told apart from failure.

Remarks

Only the /Resources entry stored on the page dictionary itself is inspected; resources inherited from an ancestor page-tree node are counted only once the library has materialised that dictionary for the page. Entries are counted, not deduplicated: one font listed under two resource names counts twice, and a font that is declared but never drawn still counts. Walk the page with GetPageFontID and a 1-based index in 1..result to obtain each font dictionary's object number, and use FindFonts or EnumDocumentFonts when a document-wide list with font properties is needed.