Table of Contents

Method CreateFont

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

CreateFont(PdfDocument, Font)

Creates a new font with the font face name, italic and bold properties equal to the properties of the specified Font object.

public static PdfFont CreateFont(this PdfDocument doc, Font font)

Parameters

doc PdfDocument

The document.

font Font

The Font to take font face name, italic and bold properties from.

Returns

PdfFont

A new PdfFont object with the specified properties.

Remarks

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

FontNotFoundException

A font with the specified parameters not found in the operating system and through the provided font loader.

ArgumentNullException

doc or font is null.