Table of Contents

Method AddFont

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

AddFont(string, bool, bool, bool, bool)

Adds a new font with specified properties to the end of the collection of document fonts.

public PdfFont? AddFont(string fontFace, bool bold, bool italic, bool underline, bool strikeout)

Parameters

fontFace string

The name of the font face.

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 or null if there is no font with specified face installed.

Remarks

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

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.

AddFont(string)

Adds a new font with specified face name to the end of the collection of document fonts.

public PdfFont? AddFont(string fontFace)

Parameters

fontFace string

The name of the font face.

Returns

PdfFont

The newly added PdfFont or null if there is no font with specified face installed.

Remarks

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.

AddFont(PdfBuiltInFont, bool, bool)

Adds a new instance of built-in font with specified properties to the end of the collection of document fonts.

public PdfFont AddFont(PdfBuiltInFont font, bool underline, bool strikeout)

Parameters

font PdfBuiltInFont

The PdfBuiltInFont value that specifies the font to add.

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

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

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

AddFont(PdfBuiltInFont)

Adds a new instance of built-in font to the end of the collection of document fonts.

public PdfFont AddFont(PdfBuiltInFont font)

Parameters

font PdfBuiltInFont

The PdfBuiltInFont value that specifies the font to add.

Returns

PdfFont

The newly added PdfFont.

Remarks

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

AddFont(byte[], bool, bool, bool, bool)

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

public PdfFont AddFont(byte[] fontBytes, bool bold, bool italic, bool underline, bool strikeout)

Parameters

fontBytes byte[]

The font bytes.

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.

AddFont(byte[], bool, bool)

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

public PdfFont AddFont(byte[] fontBytes, bool bold, bool italic)

Parameters

fontBytes byte[]

The font bytes.

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.

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.

AddFont(byte[])

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

public PdfFont AddFont(byte[] fontBytes)

Parameters

fontBytes byte[]

The buffer with the font bytes.

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.

AddFont(Stream, bool, bool, bool, bool)

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

public PdfFont AddFont(Stream fontStream, bool bold, bool italic, bool underline, bool strikeout)

Parameters

fontStream Stream

The stream with the font bytes.

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.

AddFont(Stream, bool, bool)

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

public PdfFont AddFont(Stream fontStream, bool bold, bool italic)

Parameters

fontStream Stream

The stream with the font bytes.

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.

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.

AddFont(Stream)

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

public PdfFont AddFont(Stream fontStream)

Parameters

fontStream Stream

The stream with the font bytes.

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.