PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllThis method sets the new font and its attributes for text output.
|
| HRESULT PDFPAGE_SetActiveFont ( BSTR fontName, VARIANT_BOOL fontStyleBold, VARIANT_BOOL fontStyleItalic, VARIANT_BOOL fontStyleUnderline, VARIANT_BOOL fontStyleStrikeOut, DOUBLE fontSize, TxFontCharset fontCharset ) |
Parameters
fontName
Name of a TrueType, Type1, CJK font, or one of the Standard Adobe Base14 fonts.
fontStyleBold
Specifies a bold font if set to VARIANT_TRUE
fontStyleItalic
Specifies an italic font if set to VARIANT_TRUE
fontStyleUnderline
Specifies an underlined font if set to VARIANT_TRUE
fontStyleStrikeOut
Specifies a strikeout font if set to VARIANT_TRUE
fontSize
Font size in points
fontCharset
Font character set.
Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.
Remarks
This procedure sets the active font for text operations. fontName is the name of a TrueType, Type1, or Standard Adobe Base14 font or the value returned from methods AddTTFFontFromFile, AddTTFFontFromFile2, AddType1FontFromFile. For CJK fonts, you can use both ANSI and unicode font names.
For symbolic fonts, such as "Symbol", "ZapfDingbats" (Type1), or "Marlett" (TrueType), it is strongly recommended that you set fontCharset = charsetDEFAULT_charset, to guarantee that the text will display correctly.
Equivalent in new interface: IPDFDocument4::UseFont.
Example
How to Set the Active Font
Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.PDFPAGE_SetActiveFont('Helvetica', false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 20, 0.0, 'Helvetica Font.');
PDF.PDFPAGE_SetActiveFont('Courier', false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 40, 0.0, 'Courier Font.');
PDF.PDFPAGE_SetActiveFont('Times New Roman', false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 60, 0.0, 'Times New Roman Font.');
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetActiveFont("Helvetica", FALSE, FALSE, FALSE, FALSE, 16.0, 0);
PDF->PDFPAGE_TextOut(20, 20, 0.0, "Helvetica Font.");
PDF->PDFPAGE_SetActiveFont("Courier", FALSE, FALSE, FALSE, FALSE, 16.0, 0);
PDF->PDFPAGE_TextOut(20, 40, 0.0, "Courier Font.");
PDF->PDFPAGE_SetActiveFont("Times New Roman", FALSE, FALSE, FALSE, FALSE, 16.0, 0);
PDF->PDFPAGE_TextOut(20, 60, 0.0, "Times New Roman Font.");
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetActiveFont("Helvetica", false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 20, 0.0, "Helvetica Font.");
PDF.PDFPAGE_SetActiveFont("Courier", false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 40, 0.0, "Courier Font.");
PDF.PDFPAGE_SetActiveFont("Times New Roman", false, false, false, false, 16.0, 0);
PDF.PDFPAGE_TextOut(20, 60, 0.0, "Times New Roman Font.");
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created PDF.BeginDoc PDF.PDFPAGE_SetActiveFont "Helvetica", False, False, False, False, 16.0, 0 PDF.PDFPAGE_TextOut 20, 20, 0.0, "Helvetica Font." PDF.PDFPAGE_SetActiveFont "Courier", False, False, False, False, 16.0, 0 PDF.PDFPAGE_TextOut 20, 40, 0.0, "Courier Font." PDF.PDFPAGE_SetActiveFont "Times New Roman", False, False, False, False, 16.0, 0 PDF.PDFPAGE_TextOut 20, 60, 0.0, "Times New Roman Font." PDF.EndDoc
See Also
Reference


