Persits Software, Inc. Knowledge Base Articles

Article: PS040206127

Character out of range error when using a standard font

Problem Description

When drawing text on a document with AspPDF using one of the standard 14 fonts, the method DrawText generates the following error:

Persits.PdfManager.1 error '800A0025'
Character nnn out of range (font "Helvetica").

(Another font may be mentioned in the error message).

Solution

The standard PDF fonts (Courier, Times-Roman and Helvetica families) only support characters in the ASCII range. They do not support Unicode codes such as 8230 (…), 8364 (€), etc.

To display Unicode characters, you must use a TrueType/OpenType font supporting a wide range of Unicode characters:

Set Font = Doc.Fonts("Arial")

Arial is not a standard font, so AspPDF will attempt to load this font from its arial.ttf file.

You can also load a TrueType/OpenType font directly from its .ttf or .otf file using the LoadFromFile method, as follows:

Set Font = Doc.Fonts.LoadFromFile("c:\winnt\fonts\arial.ttf")

Created: 2/6/2004 • Last Modified: 2/6/2004