Components for Developers
© 2000-2008, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
General document methods
Abort
Aborted
AddImageFromBitmapHandle
AddImageFromBuffer
AddImageFromFile
AddImageFromFilename
AddImageFromMemory
AddImageWithColorMask
AddImageWithMask
AddTTFFontFromFile
AddTTFFontFromFile2
AddType1FontFromFile
AutoCreateURL
AutoLaunch
BeginDoc
BinaryImage
Compression
CreateWaterMark
CurrentWaterMarkIndex
DocumentInfo_Author
DocumentInfo_CreationDate
DocumentInfo_Creator
DocumentInfo_Keywords
DocumentInfo_Producer
DocumentInfo_Subject
DocumentInfo_Title
EndDoc
FileName
FlipImage
FontEmbedStyle
GenerateInMemoryFile
GetCurrentPageIndex
GetImageCount
GetImageHeight
GetImageResolution
GetImageWidth
GetUsedDC
GetUsedDCResolution
GlyphsToUnicodeStr
HDC
InitialZoom
InitialZoom2
JPEGQuality
LastError
LoadICCProfile
LogActionsAndErrors
LogTextOperation
MakeImageGrayScale
MakeImageNegative
MemoryFileSize
MetafileImagesCompressionType
MetafileImagesJpegCompression
NewPage
NonEmbeddedFonts
NonEmbeddedFonts_Add
NotEmbedAnyFonts
OnePass
OutputByteStream
OwnerPassword
PageCount
PageHeight
PageLayout
PageMode
PageNumber
PageWidth
PlaceImageToCurrentPage
PlayEMF
PrinterForVirtualDC
Printing
ProducePDFA
ProtectionEnabled
ProtectionKeyLength
ProtectionOptions_coAssembly
ProtectionOptions_coCopyInformation
ProtectionOptions_coExtractInfo
ProtectionOptions_coFillAnnotation
ProtectionOptions_coModifyAnnotation
ProtectionOptions_coModifyStructure
ProtectionOptions_coPrint
ProtectionOptions_coPrintHigh
Resolution
SetCurrentPage
SetPDFAOutputIntent
SetPDFXOutputIntent
StartEngine
SwitchedToWatermark
UseCurrentDocumentResolutionForNextPages
UserPassword
UseScreenDC
Version
ViewerPreferences_vpCenterWindow
ViewerPreferences_vpFitWindow
ViewerPreferences_vpHideMenuBar
ViewerPreferences_vpHideToolBar
ViewerPreferences_vpHideWindowUI
Collapse All

Adds a TTF font from file and return a font name.

Syntax

BSTR AddTTFFontFromFile (
BSTR fontFile,
TxFontCharset charset
)
Parameters
fontFile
Path to font file.

charset
Character set of loading font.

Return value
Added font name or empty string if the font can't be added (it may happen if you try to add commercial font).

Remarks

This function can load and add not only TTF files. It may also add OTF and Type1 fonts.

If you don't know what is the type of font you want to add, then just call AddTTFFontFromFile2, this function will determine font's type and try to add it.

The return value is a name of the font added and can be used in PDFPAGE_SetActiveFont.

Analogues in new interface: IPDFDocument4::AddFont, IPDFDocument4::AddFontFromFile, IPDFDocument4::AddBuiltInFont.

Example

Add font from file

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
fontName := PDF.AddTTFFontFromFile('c:\path\to\font.ttf', charsetDEFAULT_CHARSET);
PDF.PDFPAGE_SetActiveFont(fontName, False, False, False, False, 14, charsetDEFAULT_CHARSET);
PDF.PDFPAGE_TextOut(100, 100, 0.0, '0123456789');
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
CString fontName = PDF.AddTTFFontFromFile("c:\\path\\to\\font.ttf", charsetDEFAULT_CHARSET);
PDF.PDFPAGE_SetActiveFont(fontName, FALSE, FALSE, FALSE, FALSE, 14.0, charsetDEFAULT_CHARSET);
PDF.PDFPAGE_TextOut(100, 100, 0.0, "0123456789");
PDF.EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
string fontName = PDF.AddTTFFontFromFile("c:\\path\\to\\font.ttf", 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();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
fontName = PDF.AddTTFFontFromFile("c:\path\to\font.ttf", charsetDEFAULT_CHARSET)
PDF.PDFPAGE_SetActiveFont fontName, False, False, False, False, 14, charsetDEFAULT_CHARSET
PDF.PDFPAGE_TextOut 100, 100, 0, "0123456789"
PDF.EndDoc

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2008, Two Pilots