Error adding PDF file (missing fonts)

Symptom

There is an error when uploading some PDF files (i.e. some PDFs upload fine). These PDFs use CID fonts, for example Chinese, Japanese, Korean.
If you have problems uploading ALL PDF files then please see this article.

In the Asset Bank error log, you see an error like this:
Unrecoverable error, exit code 1 GPL Ghostscript 8.62: Unrecoverable error, exit code

Cause

This error is occurring because the required fonts are not embedded within the PDF and so Ghostscript (the library Asset Bank use for converting Postscript files) does not know which fonts to use. In fact, it shouldn‘t be possible to generate a PDF file without its required fonts, as it‘s not a valid PDF, but unfortunately some PDF-creation software lets you do it.

Solution

Tell Ghostscript to make a substitution for a Windows font. To do this, you need to know the exact name of the missing font - see the note at the bottom of this article for instructions on how to find it out.
For this example, imagine a PDF that needs ‘STHeiti‘, a Chinese Simplified font from a Mac.
We will configure Ghostscript to use the Windows font ‘Simhei‘ in its place, which is a proportional, Chinese Simplified font.
1) Make sure that the font you want to use as a substitute is installed on the server on which Asset Bank is installed. For this example, you would look in C:/Windows/fonts for the file ‘simhei.ttf‘. If the font you want does not exist then you will need to either install it or select a different (suitable) font.

2) Open the Ghostscript ‘cidfmap‘ file (which tells it how to map fonts) in a text editor. This will be in the Ghostscript ‘lib‘ directory, for example: C:\Program Files\gs\gs8.63\lib\cidfmap Add a line in the section ‘% Substitutions‘ according to the syntax described here: http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#CIDFontSubstitution If you are using our example, the line would be:

/STHeiti << /FileType /TrueType /Path (C:/Windows/fonts/simhei.ttf) /SubfontID 0 /CSI [(GB1) 2] >> ;

(If your Windows font directory is different from C:/Windows/fonts then change as necessary).

3) Save the ‘cidfmap‘ file.

That should be it!

Please note: you need to know the name of the missing font, so that you can add the right mapping to cidfmap. Here‘s the easiest way to determine that:
1) Open a command prompt.
2) cd to a directory containing the errant PDF
3) type:
convert mydocument.PDF[0] test.jpg [where mydocument.PDF is the name of your PDF]
This command attempts to create a jpg from the first page of the PDF. You should see an error, looking something like this:

Error: /undefinedresource in findresource Operand stack:
--nostringval-- --dict:11/20(L)-- C2_0 1 --dict:5/5(L)-- --dict:5/5
(L)-- STHeiti --dict:11/12(ro)(G)-- --nostringval-- CIDFontObject --di
ct:7/7(L)-- --dict:7/7(L)-- Adobe-GB1 CIDFont Adobe-GB1
Execution stack:
[etc]

The missing font is named on the fourth line of this error, e.g. see ‘STHeiti‘ in the above example.


Was this article helpful?

Yes No

Thanks for your feedback!