Using Fonts

PDFReport XP allows to use different kind of fonts in many different sizes.

The first thing it is necessary to underline is that it is NOT available a BOLD or ITALIC version of a single font. This is due to technical specs by Adobe. For example, when you choose Courier Bold you are using a completely different font in respect of the standard Courier; also, when you use a font which hasn't a "Bold" version available, PDFWriter tries to emulate it in various ways, all of them criticals. For example, many programs generate Bold versions of fonts simply by drwaing many times the same textm every time shifting it to the right of 0.01 mm. Of course, if you select this text you won't have bold text, but the same string repeated hundreds of times!

So if you want a COURIER BOLD font, use the COURIER bold Typeface. PDF is not Windows, and you must follow its rules.

To change the font name, you just have to change a single property (FontName) like in this example:

Private Sub Command2_Click()
  Dim PDFRPT As New PDFDocument
  PDFRPT.NewPDF "This is my first PDF"
  PDFRPT.FontName = "Helvetica-Bold"
  PDFRPT.TextOut "Hello World!", 10, 10
  PDFRPT.SavePDF "c:\provaocx.pdf"
End Sub

This is the result:

In a similar manner you can also change the font Size using the FontHeight Property:

Private Sub Command2_Click()
  Dim PDFRPT As New PDFDocument
  PDFRPT.NewPDF "This is my first PDF"
  PDFRPT.FontName = "Helvetica-Bold"
  PDFRPT.FontHeight = 72
  PDFRPT.TextOut "Hello World!", 10, 70
  PDFRPT.SavePDF "c:\provaocx.pdf"
End Sub

In every Acrobat PDF file there are always this standard Postscript fonts incorporated:

  1. Courier
  2. Helvetica
  3. Times
  4. Courier-Bold
  5. Helvetica-Bold
  6. Times-Bold
  7. Courier-Oblique
  8. Helvetica-Oblique
  9. Times-Oblique
  10. Courier-BoldOblique
  11. Helvetica-BoldOblique
  12. Times-BoldOblique

Use these descriptions as valid "FontName" Property values.

The source code of the project can also be found here.