Table of Contents

Method CreateFontFromFile

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

CreateFontFromFile(string)

Creates a new font from the specified font file.

public PdfFont CreateFontFromFile(string fontFilePath)

Parameters

fontFilePath string

The path to the font file.

Returns

PdfFont

A new PdfFont object created from the provide font data.

Remarks

This method accepts OpenType, TrueType, and Type1 font data.

The library tries to embed every created font in the PDF document. However, if the associated font license (i.e. fsType field in the corresponding TTF/OTF bytes) does not allow embedding, then the library won't embed the font. Check the Embedded property of the created font to know if the library will embed it in the output PDF.

Check out the Using PDF fonts sample code for an example of using the created font.

Exceptions

UnsupportedFontException

The library can not create a PDF font from the specified font file. Please send us the font file for a review.

ArgumentNullException

fontFilePath is null.

FileNotFoundException

Thrown if the font file does not exist at the specified path.