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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontFace, bold, italic) instead. To underline/strike through a text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont? AddFont(string fontFace, bool bold, bool italic, bool underline, bool strikeout)
Parameters
fontFacestringThe name of the font face.
boldboolif set to
truethen added font will be bold.italicboolif set to
truethen added font will be italic.underlineboolif set to
truethen text drawn with added font will be underlined.strikeoutboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontFace) instead.")]
public PdfFont? AddFont(string fontFace)
Parameters
fontFacestringThe 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(font) instead. To underline/strike through a text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont AddFont(PdfBuiltInFont font, bool underline, bool strikeout)
Parameters
fontPdfBuiltInFontThe PdfBuiltInFont value that specifies the font to add.
underlineboolif set to
truethen text drawn with added font will be underlined.strikeoutboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(font) instead.")]
public PdfFont AddFont(PdfBuiltInFont font)
Parameters
fontPdfBuiltInFontThe 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontBytes) instead. To underline/strike through a text, or synthesize bold or italic text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont AddFont(byte[] fontBytes, bool bold, bool italic, bool underline, bool strikeout)
Parameters
fontBytesbyte[]The font bytes.
boldboolif set to
truethen added font will be bold.italicboolif set to
truethen added font will be italic.underlineboolif set to
truethen text drawn with added font will be underlined.strikeoutboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontBytes) instead. To synthesize bold or italic text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont AddFont(byte[] fontBytes, bool bold, bool italic)
Parameters
fontBytesbyte[]The font bytes.
boldboolif set to
truethen added font will be bold.italicboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontBytes) instead.")]
public PdfFont AddFont(byte[] fontBytes)
Parameters
fontBytesbyte[]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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontStream) instead. To underline/strike through a text, or synthesize bold or italic text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont AddFont(Stream fontStream, bool bold, bool italic, bool underline, bool strikeout)
Parameters
fontStreamStreamThe stream with the font bytes.
boldboolif set to
truethen added font will be bold.italicboolif set to
truethen added font will be italic.underlineboolif set to
truethen text drawn with added font will be underlined.strikeoutboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontStream) instead. To underline/strike through a text, use properties with similar names from PdfStringDrawingOptions and PdfTextDrawingOptions.")]
public PdfFont AddFont(Stream fontStream, bool bold, bool italic)
Parameters
fontStreamStreamThe stream with the font bytes.
boldboolif set to
truethen added font will be bold.italicboolif set to
truethen 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.
[Obsolete("This method will be removed in the next release of the library. Use the CreateFont(fontStream) instead.")]
public PdfFont AddFont(Stream fontStream)
Parameters
fontStreamStreamThe 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.