Method TextStyleWithFont
- Namespace
- BitMiracle.Docotic.Pdf.Layout
- Assembly
- BitMiracle.Docotic.Pdf.Layout.dll
TextStyleWithFont(SystemFont, FontEmbedMode?)
Creates a text style based on a font from the system font collection.
public TextStyle TextStyleWithFont(SystemFont font, FontEmbedMode? embedMode = null)
Parameters
fontSystemFontThe description of the font.
embedModeFontEmbedMode?The preferred font embed mode. Can be
null.
Returns
- TextStyle
The text style associated with the font.
Remarks
When embedMode is null the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
fontisnull.- FontNotFoundException
Unable to load font. Make sure that the font is installed in the system font collection or can be loaded using the current IFontLoader.
TextStyleWithFont(FileInfo, FontEmbedMode?)
Creates a text style based on a font from file.
public TextStyle TextStyleWithFont(FileInfo file, FontEmbedMode? embedMode = null)
Parameters
fileFileInfoThe font file.
embedModeFontEmbedMode?The preferred font embed mode. Can be
null.
Returns
- TextStyle
The text style associated with the font.
Remarks
When embedMode is null the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
fileisnull.
TextStyleWithFont(Stream, FontEmbedMode?)
Creates a text style based on a font from stream.
public TextStyle TextStyleWithFont(Stream stream, FontEmbedMode? embedMode = null)
Parameters
streamStreamThe font stream.
embedModeFontEmbedMode?The preferred font embed mode. Can be
null.
Returns
- TextStyle
The text style associated with the font.
Remarks
Caller of the method is responsible for disposing of the stream.
When embedMode is null the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
streamisnull.