Importing TrueType Fonts

You are able to embed your installed truetype fonts inside your PDF files.

This is particularly useful for corporate image and to recreate vectorial logos.

The syntax to import a truetype font is as follows:

AddFont (AFontName, AFileName)

AFontName is the font's name as can be seen inside the font menu in WordPad or Word. You can also see it double clicking the ttf file.

The AFileName is the name of the *.TTF file (complete with its path).

Please note that you must have that font installed on the system where you are generating the PDF file, while it is not needed on the target reader system. This is needed as it could not be possible otherwise to calculate the necessary font metrics.

When you decide to use this font to write some text, just set the FontName property to the font name (which is the AFontName parameter you have just used, by the way).

For example:

Private Sub Command10_Click()
Dim PDFRPT As New PDFDocument
PDFRPT.NewPDF "This is my first PDF"
PDFRPT.FontHeight = 20
PDFRPT.FontName = "Helvetica"
PDFRPT.TextOut "This is 'Helvetica' font", 10, 10
PDFRPT.AddFont "Demian Bold LET", _ "C:\WINNT\Fonts\76804___.ttf"
PDFRPT.FontName = "Demian Bold LET"
PDFRPT.TextOut "This is 'Demian Bold LET' font", _ 10, 30
PDFRPT.SavePDF "c:\provaocx.pdf"
End Sub

Here's the resulting PDF file:

As you can see you can obtain amazing grapical results inside your documentation using PDFReport XP.