This method adds a Type1 font from a file and returns the font name.
BSTR AddType1FontFromFile ( BSTR afmFontFile, BSTR pfbFontFile, TxFontCharset charset ) |
If you don't know the font's type, use AddTTFFontFromFile2instead. This method will determine the font's type and try to load it.
The return value is the name of the font added and can be used in PDFPAGE_SetActiveFont.
Equivalents in new interface: IPDFDocument4::AddFont, IPDFDocument4::AddFontFromFile, IPDFDocument4::AddBuiltInFont.
{ PDF object is supposed to be created } PDF.BeginDoc; fontName := PDF.AddType1FontFromFile('c:\path\to\font.afm' 'c:\path\to\font.pfb', charsetDEFAULT_CHARSET); PDF.PDFPAGE_SetActiveFont(fontName, False, False, False, False, 14, charsetDEFAULT_CHARSET); PDF.PDFPAGE_TextOut(100, 100, 0.0, '0123456789'); PDF.EndDoc;
// PDF object is supposed to be created PDF->BeginDoc(); CString fontName = PDF.AddType1FontFromFile("c:\\path\\to\\font.afm", "c:\\path\\to\\font.pfb", charsetDEFAULT_CHARSET); PDF.PDFPAGE_SetActiveFont(fontName, FALSE, FALSE, FALSE, FALSE, 14.0, charsetDEFAULT_CHARSET); PDF.PDFPAGE_TextOut(100, 100, 0.0, "0123456789"); PDF.EndDoc();
// PDF object is supposed to be created PDF->BeginDoc(); string fontName = PDF.AddType1FontFromFile("c:\\path\\to\\font.afm", "c:\\path\\to\\font.pfb", TxFontCharset.charsetDEFAULT_CHARSET); PDF.PDFPAGE_SetActiveFont(fontName, false, false, false, false, 14.0, TxFontCharset.charsetDEFAULT_CHARSET); PDF.PDFPAGE_TextOut(100, 100, 0.0, "0123456789"); PDF.EndDoc();
' PDF object is supposed to be created PDF.BeginDoc fontName = PDF.AddType1FontFromFile("c:\path\to\font.afm", "c:\path\to\font.pfb", charsetDEFAULT_CHARSET) PDF.PDFPAGE_SetActiveFont fontName, False, False, False, False, 14, charsetDEFAULT_CHARSET PDF.PDFPAGE_TextOut 100, 100, 0.0, "0123456789" PDF.EndDoc