Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.GetFontsAsJSON

Queries all fonts within the PDF as JSON array.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 10.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.GetFontsAsJSON"; PDF { ; Flags } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Flags Pass value for combination of flags you need.
Add 4 to include font buffer data.
0 Optional

Result

Returns JSON or error.

Description

Queries all fonts within the PDF as JSON array.
See TPDFFontInfo structure in DynaPDF help, which we convert to JSON for you.

Keys include Ascent, AvgWidth, BaseEncoding, BaseFont, CapHeight, CharSet, CharSetSize, CIDOrdering, CIDRegistry, CIDSet, CIDSetSize, CIDSupplement, CIDToGIDMap, CIDToGIDMapSize, CMapBuf, CMapBufSize, CMapName, Descent, Encoding, FirstChar, Flags, FontBBox, FontBuffer, FontBufSize, FontFamily, FontFilePath, FontFileType, FontName, FontStretch, FontType, FontWeight, FullName, HaveEncoding, HorzWidths, HorzWidthsCount, Imported, ItalicAngle, Lang, LastChar, Leading, Length1, Length2, Length3, MaxWidth, Metadata, MetadataSize, MisWidth, Panose, PostScriptName, SpaceWidth, StemH, StemV, ToUnicode, ToUnicodeSize, VertDefPos, VertWidths, VertWidthsCount, WMode, XHeight and Index.

See also GetFontsAsJSON function in DynaPDF manual.

Examples

Query JSON:

Set Variable [ $JSON; Value: MBS( "DynaPDF.GetFontsAsJSON"; PDF ) ]

Query fonts:

Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; PDF JSON::PDF) ]
# import a page
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
#
# query all fonts:
Set Variable [ $JSON ; Value: MBS("DynaPDF.GetFieldsAsJSON"; $pdf) ]
If [ MBS("IsError") = 0 ]
    Set Variable [ $JSON ; Value: MBS("JSON.Colorize"; $JSON) ]
End If
#
# store in field
Set Field [ PDF JSON::JSON ; $JSON ]
# Release memory
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 16th September 2020, last changed 2nd September 2022


DynaPDF.GetFontWeight - DynaPDF.GetFullyQualifiedFieldName