Embeds a font into the document.




FontID = Doc.EmbedFont(FontName [,Language[, Vertical[, Subset[, Force]]]])



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.

Subset Boolean

Whether to subset the font (optional).

See the Fonts and Languages section for details on subsetting. The default is false to indicate that the font should not be subsetted.

Force Boolean

Whether to override permissions on the font (optional).

Fonts often contain embedded licensing information. By default, ABCpdf will prevent you from embedding fonts which indicate that embedding is not permitted.

You can force the font to be embedded by passing true for this value.

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




Embeds a font into the document.

The font name, a description of the font style and the the font glyph descriptions themselves are placed into the document. This ensures that the document will always display perfectly on every system and that font substitutions will never need to be made.

There are a number of reasons you may not wish to embed fonts and, instead, use the AddFont method. Embedding fonts can increase the size of your PDF considerably. Additionally, by distributing a PDF with an embedded font, you are actually redistributing the font itself. You should check with your font supplier or legal department that you have permission to do this.

For information on how to specify font names, see the AddFont method.

The EmbedFont method 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")

If the specified font could not be found, then you will get an Object ID of zero returned. You may wish to check for this possibility. Otherwise, a default font will be used.

Fonts are cached so newly added fonts will not be available to ABCpdf until the application is restarted. If you need to dynamically load a font, you can pass this method a path to your font file. This will add the font to the cache and make it available for use. You should not move, rename or delete a font file which has been dynamically loaded using this technique.




The following code embeds the font 'Comic Sans MS' into the document and then adds some text.

Set theDoc = Server.CreateObject("ABCpdf10.Doc")
theDoc.FontSize = 216
theFont = "Comic Sans MS"
theDoc.Font = theDoc.EmbedFont(theFont)
theDoc.AddText theFont
theDoc.Save "c:\mypdfs\docembedfont.pdf"