Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Wednesday, November 14, 2007

GPL Ghostscript 8.54: Unrecoverable error, exit code 1

Leslie asked me about this error today:

GPL Ghostscript 8.54: Unrecoverable error, exit code 1

This error comes whenever trying to use ghostscript.

It is possible that this error is appearing because ghostscript is unable to find fonts. This is what I found when I googled:

Fonts are distributed (and installed) independently from GS since they are provided by others (not Artifex Software or the developers of Ghostscript).

Fonts will have the .pfb suffix, so a find . -name "*.pfb" -print from some top level directory (such as /usr or /app) will locate them for you. Then you can either:

1) Symbolic link to the font directory as the expected dir for example:

ln -s /usr/local/share/ghostscript/fonts /app/ghostscript-8.00/share/ghostscript/fonts

2) Tell gs where to find the fonts using the -I option to add a search path. For example:

gs -I/usr/local/share/ghostscript/fonts ...

3) Set the GS_LIB environment variable to specify the dir For example (bin/sh or bin/ksh or bin/bash):

export GS_LIB=/usr/local/share/ghostscript/fonts

Of course, if you don't already have the fonts installed, then do
so first.

Regards,
Ray Johnston
Artifex Software Inc.

Based on the above information, this is what I did:

# /usr/local/bin/pdf2ps /tmp/justanexample.pdf - | lp -d HPDLC
Error creating job: check spooling directory: /var/spool/print

$ /usr/local/bin/pdf2ps /tmp/justanexample.pdf
Error: /invalidfont in findfont
Operand stack:
--dict:5/5(L)-- F1 10 --dict:8/8(L)-- --dict:8/8(L)-- ModenaCondensedLight --dict:12/12(L)-- Helvetica-Narrow Helvetica-Narrow Font Helvetica-Narrow 1426219 Helvetica-Narrow --nostringval-- Helvetica-Narrow NimbusSanL-ReguCond
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 5 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- 9 13 %oparray_pop 10 13 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 13 14 %oparray_pop --nostringval-- --nostringval-- --nostringval-- 1 -1 1 --nostringval-- %for_neg_int_continue
Dictionary stack:
--dict:1120/1686(ro)(G)-- --dict:2/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:105/127(ro)(G)-- --dict:253/347(ro)(G)-- --dict:21/24(L)-- --dict:4/6(L)-- --dict:20/20(L)-- --dict:1/1(ro)(G)-- --dict:1/1(ro)(G)-- --dict:1/1(ro)(G)-- --dict:8/8(L)-- --dict:17/17(ro)(G)-- --dict:1120/1686(ro)(G)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.54: Unrecoverable error, exit code 1
dasvi@tsgsd1008 #

gs –h tells me the font directory:

dasvi@tsgsd1008 # gs -h
GPL Ghostscript 8.54 (2006-05-17)
Copyright (C) 2006 artofcode LLC, Benicia, CA. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-gx page size in pixels | -r pixels/inch resolution
-sDEVICE= select device | -dBATCH exit after last file
-sOutputFile= select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11
Available devices:
bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
cljet5 cljet5c deskjet devicen djet500 epswrite faxg3 faxg32d faxg4 ijs
jpeg jpeggray laserjet lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d
ljetplus nullpage pbm pbmraw pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono
pdfwrite pgm pgmraw pgnm pgnmraw pj pjxl pjxl300 pkm pkmraw pksm pksmraw
png16 png16m png256 png48 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw
ps2write psdcmyk psdrgb psgray psmono psrgb pswrite pxlcolor pxlmono
spotcmyk tiff12nc tiff24nc tiff32nc tiffcrle tiffg3 tiffg32d tiffg4
tiffgray tifflzw tiffpack tiffsep uniprint x11 x11alpha x11cmyk x11gray2
x11gray4 x11mono xcf
Search path:
. : /usr/local/share/ghostscript/8.54/lib :
/usr/local/share/ghostscript/8.54/Resource :
/usr/local/share/ghostscript/fonts
For more information, see /usr/local/share/ghostscript/8.54/doc/Use.htm.
Report bugs to bug-gs@ghostscript.com, using the form in Bug-form.htm.

I checked for font directory

$ ls -ltr /usr/local/share/ghostscript/fonts
/usr/local/share/ghostscript/fonts: No such file or directory
$ ls -ld /usr/local/share/ghostscript/fonts
/usr/local/share/ghostscript/fonts: No such file or directory

The problem is occurring because the fonts directory does not exist.

To fix this I created a soft link:

# cd /usr/local/share/ghostscript
# ln -s /usr/sfw/share/ghostscript/fonts fonts
# /usr/local/bin/pdf2ps /tmp/justanexample.pdf

**** Warning: Fonts with Subtype = /TrueType should be embedded.
The following fonts were not embedded:
ModenaCondensedLight
ModenaCondensedMedium
ModenaCondensedRegular

**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Actuate XML to PDF Converter 1.0 <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification. # /usr/local/bin/pdf2ps /tmp/hutch_bill_Aug.pdf - | lp -d HPDLC **** Warning: Fonts with Subtype = /TrueType should be embedded. The following fonts were not embedded: ModenaCondensedLight ModenaCondensedMedium ModenaCondensedRegular **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> Actuate XML to PDF Converter 1.0 <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification. request id is HPDLC-10 (1 file) # ls -ltr justanexample.ps -rw-r--r-- 1 root root 201770 Nov 15 15:32 justanexample.ps The command is not erroring out any more and the expected output of .ps file is created. I did all this as root user. Lets test this as a normal user: dasvi@tsgsd1008 # /usr/local/bin/pdf2ps /tmp/hutch_bill_Aug.pdf **** Warning: Fonts with Subtype = /TrueType should be embedded. The following fonts were not embedded: ModenaCondensedLight ModenaCondensedMedium ModenaCondensedRegular **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> Actuate XML to PDF Converter 1.0 <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification. $ /usr/local/bin/pdf2ps /tmp/hutch_bill_Aug.pdf - | lp -d HPDLC_ Error creating job: check spooling directory: /var/spool/print

This could be due to the fact that lp can't be used by normal users. Let us check the permissions on lp binary:

$ which lp
/usr/bin/lp

$ sudo su - root
# ls -ltr lp
-rwxr-xr-x 1 root lp 28092 Jan 22 2005 lp

These permissions do not allow normal users to print. setuid needs to be on the lp binary to allow normal users to print. So I changed the permissions:

# chmod 4511 lp
# ls -ltr lp
-r-s--x--x 1 root lp 28092 Jan 22 2005 lp
# exit
$ /usr/local/bin/pdf2ps /tmp/hutch_bill_Aug.pdf - | lp -d HPDLC_G

**** Warning: Fonts with Subtype = /TrueType should be embedded.
The following fonts were not embedded:
ModenaCondensedLight
ModenaCondensedMedium
ModenaCondensedRegular

**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Actuate XML to PDF Converter 1.0 <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification. request id is HPDLC-11 (1 file) Now it works for any normal user.

2 comments:

Gary said...

Do you know where I could find a good xml to pdf converter? I need some help.

Anonymous said...

Thanks for sharing this