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
stringThe name of the font file.
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.
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
stringThe name of the font file.
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.
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
stringThe name of the font file.
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.