Table of Contents

Method AddFontFromFile

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

AddFontFromFile(string, bool, bool, bool, bool)

Creates a new font with specified properties using provided font file and adds the new font to the end of the collection of document fonts.

public PdfFont AddFontFromFile(string fileName, bool bold, bool italic, bool underline, bool strikeout)

Parameters

fileName string

The name of the font file.

bold bool

if set to true then added font will be bold.

italic bool

if set to true then added font will be italic.

underline bool

if set to true then text drawn with added font will be underlined.

strikeout bool

if set to true then text drawn with added font will be stroked out.

Returns

PdfFont

The newly added PdfFont.

Remarks

If requested font does not have bold or italic version then bold or italic version will be synthesized when needed.

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

The library tries to embed added fonts in a PDF document but respects a font license. If an associated font license (e.g., fsType field for TTF/OTF documents) does not allow embedding then the library will add a font unembedded. You can check the Embedded property for the added font.

AddFontFromFile(string, bool, bool)

Creates a new font with specified properties using provided font file and adds the new font to the end of the collection of document fonts.

public PdfFont AddFontFromFile(string fileName, bool bold, bool italic)

Parameters

fileName string

The name of the font file.

bold bool

if set to true then added font will be bold.

italic bool

if set to true then added font will be italic.

Returns

PdfFont

The newly added PdfFont.

Remarks

If requested font does not have bold or italic version then bold or italic version will be synthesized when needed.

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

AddFontFromFile(string)

Creates a new font using provided font file and adds the new font to the end of the collection of document fonts.

public PdfFont AddFontFromFile(string fileName)

Parameters

fileName string

The name of the font file.

Returns

PdfFont

The newly added PdfFont.

Remarks

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

The library tries to embed added fonts in a PDF document but respects a font license. If an associated font license (e.g., fsType field for TTF/OTF documents) does not allow embedding then the library will add a font unembedded. You can check the Embedded property for the added font.