Method FromFile

Namespace
SoftZenPdf
Assembly
SoftZenPdf.dll

FromFile(string)

Loads a TrueType font from a file; for a collection (.ttc), the first font in it.

public static TrueTypeFont FromFile(string path)

Parameters

path string

A .ttf or .ttc file (or .otf with TrueType outlines).

Returns

TrueTypeFont

The font, ready to be used with DrawText(string, double, double, PdfFont, double, PdfColor?).

Exceptions

NotSupportedException

The font has CFF outlines, or its licence forbids embedding or subsetting.

InvalidDataException

The file is not a valid TrueType font.

FromFile(string, int)

Loads one font of a TrueType collection (.ttc) file.

public static TrueTypeFont FromFile(string path, int collectionIndex)

Parameters

path string

The collection file (or a single font file, with index 0).

collectionIndex int

Which font of the collection to load, from 0; see CountFonts(byte[]).

Returns

TrueTypeFont

The font.

Exceptions

ArgumentOutOfRangeException

collectionIndex is not a font of the file.

NotSupportedException

The font has CFF outlines, or its licence forbids embedding or subsetting.

InvalidDataException

The file is not a valid TrueType font or collection.