Table of Contents

Method CreateFont

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

CreateFont(string, bool, bool)

Creates a new font with the specified font face name, italic and bold properties.

public PdfFont CreateFont(string fontFace, bool bold, bool italic)

Parameters

fontFace string

The name of the font family (e.g., "Arial").

bold bool

The value indicating whether the font should be bold.

italic bool

The value indicating whether the font should be italic.

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

fontFace is null or empty.

CreateFont(string)

Creates a new font with the specified font face name.

public PdfFont CreateFont(string fontFace)

Parameters

fontFace string

The name of the font family (e.g., "Arial").

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

fontFace is null or empty.

CreateFont(PdfBuiltInFont)

Creates a new instance of the built-in font with the specified name.

public PdfFont CreateFont(PdfBuiltInFont font)

Parameters

font PdfBuiltInFont

The name of the built-in font.

Returns

PdfFont

A new PdfFont object with the specified properties.

Remarks

Built-in fonts support only Latin character set and encoding. You won't be able to use them with Unicode text.

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

Exceptions

ArgumentOutOfRangeException

font is not one of the PdfBuiltInFont constants.

CreateFont(byte[])

Creates a new font from the provided font data in byte array format.

public PdfFont CreateFont(byte[] fontBytes)

Parameters

fontBytes byte[]

The byte array containing the font file data.

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 provided data. Please send us the font data for a review.

ArgumentNullException

fontBytes is null.

CreateFont(Stream)

Creates a new font from the provided stream containing font data.

public PdfFont CreateFont(Stream fontStream)

Parameters

fontStream Stream

The stream containing the font file data.

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 provided data. Please send us the font data for a review.

ArgumentNullException

fontStream is null.