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
stringThe name of the font face.
bold
boolif set to
true
then added font will be bold.italic
boolif set to
true
then added font will be italic.underline
boolif set to
true
then text drawn with added font will be underlined.strikeout
boolif set to
true
then text drawn with added font will be stroked out.
Returns
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
stringThe name of the font face.
Returns
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
PdfBuiltInFontThe PdfBuiltInFont value that specifies the font to add.
underline
boolif set to
true
then text drawn with added font will be underlined.strikeout
boolif set to
true
then text drawn with added font will be stroked out.
Returns
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
PdfBuiltInFontThe PdfBuiltInFont value that specifies the font to add.
Returns
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
boolif set to
true
then added font will be bold.italic
boolif set to
true
then added font will be italic.underline
boolif set to
true
then text drawn with added font will be underlined.strikeout
boolif set to
true
then text drawn with added font will be stroked out.
Returns
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
boolif set to
true
then added font will be bold.italic
boolif set to
true
then added font will be italic.
Returns
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
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
StreamThe stream with the font bytes.
bold
boolif set to
true
then added font will be bold.italic
boolif set to
true
then added font will be italic.underline
boolif set to
true
then text drawn with added font will be underlined.strikeout
boolif set to
true
then text drawn with added font will be stroked out.
Returns
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
StreamThe stream with the font bytes.
bold
boolif set to
true
then added font will be bold.italic
boolif set to
true
then added font will be italic.
Returns
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
StreamThe stream with the font bytes.
Returns
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.