Adds a font reference to the document.

 

   
Syntax
 
     

FontID = Doc.AddFont(FontName [,Language[, Vertical]])

 

   
Params
 
     
Name   Type   Description
FontName String The name of the font typeface.
Language String

The language type to use (optional).

See the Fonts and Languages section for details on language types. The default language type is Latin.

Vertical Boolean

Whether the text direction should be vertical (optional).

See the Fonts and Languages section for details on writing directions. The default is false to indicate standard left to right layout.

FontID Long The Object ID of the newly added Font Object.

 

   
Notes
 
     

Adds a font to the document.

The font name and a description of the font style is held within the document. However the actual font itself is not added to the document. If you wish to embed a font you should use the EmbedFont method.

When a client opens the PDF Acrobat will attempt to find the exact same font on the client system. If the exact font is not available then a substitute font will be chosen using the font description to determine the best match.

The following fonts are guaranteed to be available on every system.

  • Times-Roman
  • Times-Bold
  • Times-Italic
  • Times-BoldItalic
  • Helvetica
  • Helvetica-Bold
  • Helvetica-Oblique
  • Helvetica-BoldOblique
  • Courier
  • Courier-Bold
  • Courier-Oblique
  • Courier-BoldOblique
  • Symbol
  • ZapfDingbats

Additionally you can add any TrueType or OpenType font that you have installed on your system. The name you should use is the one referenced in your fonts folder. For example.

  • Arial
  • Arial Black
  • Arial Black Italic
  • ...
  • Book Antiqua
  • Book Antiqua Bold
  • Book Antiqua Bold Italic
  • Book Antiqua Italic
  • ...
  • Venetian301BT
  • Venetian301BT Bold
  • ...

The AddFont function returns the Object ID of the newly added Font Object. Typically you will want to assign this return value to the document Font property using code of the form.

theDoc.Font = theDoc.AddFont("Courier")

 

   
Example
 
     

The following code adds two pieces of text to a document. The first piece is in Times-Roman and the second in Helvetica-Bold.

Set theDoc = Server.CreateObject("ABCpdf3.Doc")
theDoc.FontSize = 48
theFont = "Times-Roman "
theDoc.Font = theDoc.AddFont(theFont)
theDoc.AddText theFont
theFont =
"Helvetica-Bold"
theDoc.Font = theDoc.AddFont(theFont)
theDoc.AddText theFont

theDoc.Save "c:\docaddfont.pdf"


docaddfont.pdf

   

 

Browser Based Help. Published by chm2web software.