At my work I had to correct a bug related to the conversion of a PDF to a jpeg. To do that we use the convert command line tools from ImageMagick.
The server which is doing the conversion run an Ubuntu with the latest version of the package ghostscript ( 8.71).
Here is the error:
11:04 1442 ~/Desktop : convert corrup1.pdf toto.jpg
Error: /undefined in findresource
Operand stack:
–dict:8/17(L)– C2_1 1 –dict:5/5(L)– –dict:5/5(L)– Arial –dict:9/12(ro)(G)– –nostringval– CIDFontObject –dict:7/7(L)– –dict:7/7(L)– Adobe-Identity
Execution stack:
%interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push –nostringval– –nostringval– –nostringval– false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop –nostringval– –nostringval– 2 1 1 –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– %array_continue –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– %loop_continue
Dictionary stack:
–dict:1161/1684(ro)(G)– –dict:1/20(G)– –dict:75/200(L)– –dict:75/200(L)– –dict:108/127(ro)(G)– –dict:288/300(ro)(G)– –dict:22/25(L)– –dict:6/8(L)– –dict:26/40(L)–
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
convert: Postscript delegate failed `corrup1.pdf’: No such file or directory @ pdf.c/ReadPDFImage/634.
convert: missing an image filename `toto.jpg’ @ convert.c/ConvertImageCommand/2838.
Weird. A google of the Error: /undefined in findresource will lead you to this bug.
To sum up the installer of ghostscript is fucked up, and no new version of the package is deploy to solve it. Awesome.
ghostscript is not able to find a font ( Adobe-Identity ) and try to find a substitution font ( Arial ) but can’t find it.
So let’s correct the configuration manually.
First make sur that you have install the microsoft webfont on your system.
Then we need to edit our cidmap which is the configuration file which tell ghostscript substitution font. Mine looks like after adding the last line:
/var/lib/defoma/gs.d/dirs/fonts/cidfmap
1 /Dotum-Bold << /FileType /TrueType /Path (/usr/share/fonts/truetype/unfonts/UnDotumBold.ttf) /SubfontID 0 /CSI [(Korea1) 0] >> ;
2 /Batang-Regular << /FileType /TrueType /Path (/usr/share/fonts/truetype/unfonts/UnBatang.ttf) /SubfontID 0 /CSI [(Korea1) 0] >> ;
3 /Batang-Bold << /FileType /TrueType /Path (/usr/share/fonts/truetype/unfonts/UnBatangBold.ttf) /SubfontID 0 /CSI [(Korea1) 0] >> ;
4 /Dotum-Regular << /FileType /TrueType /Path (/usr/share/fonts/truetype/unfonts/UnDotum.ttf) /SubfontID 0 /CSI [(Korea1) 0] >> ;
5 /Arial << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/arial.ttf) /SubfontID 0 /CSI [(Artifex) (Unicode) 0] >> ;
Make sur to use the correct path for the arial.ttf file.
Doing that produce a second error:
1:16 1442 ~/Desktop : convert corrup1.pdf toto.jpg
Can’t find CMap Identity-UTF16-H building a CIDDecoding resource.
Error: /undefinedresource in findresource
Operand stack:
–dict:8/17(L)– C2_1 1 –dict:5/5(L)– –dict:5/5(L)– Arial –dict:9/12(ro)(G)– –nostringval– CIDFontObject –dict:7/7(L)– –dict:7/7(L)– Arial CIDFont true Arial false Arial –dict:23/26(G)– Unicode.Unicode CIDDecoding true Unicode.Unicode –dict:28/48(ro)(G)– Identity-UTF16-H
Execution stack:
%interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push –nostringval– –nostringval– –nostringval– false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop –nostringval– –nostringval– 2 1 1 –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– %array_continue –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– %loop_continue –nostringval– –nostringval– 1829 13 9 %oparray_pop findresource %errorexec_pop –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– %loop_continue –nostringval– –nostringval– –nostringval– 1829 20 10 %oparray_pop findresource %errorexec_pop –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– %array_continue –nostringval–
Dictionary stack:
–dict:1161/1684(ro)(G)– –dict:1/20(G)– –dict:75/200(L)– –dict:75/200(L)– –dict:108/127(ro)(G)– –dict:288/300(ro)(G)– –dict:22/25(L)– –dict:6/8(L)– –dict:26/40(L)– –dict:20/26(ro)(G)– –dict:18/25(ro)(G)– –dict:16/25(ro)(G)–
Current allocation mode is global
Last OS error: 2
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
convert: Postscript delegate failed `corrup1.pdf’: No such file or directory @ pdf.c/ReadPDFImage/634.
convert: missing an image filename `toto.jpg’ @ convert.c/ConvertImageCommand/2838.
The error is Can’t find CMap Identity-UTF16-H. Ghostscript can’t find this, so let’s create it !
Mine need to be created in /usr/share/ghostscript/8.71/Resource/CMap/Identity-UTF16-H
The content of this file can be find here. Or copy it from here:
% Copyright (C) 2003 Artifex Software. All rights reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
%
% $Id: Identity-UTF16-H 7095 2006-10-10 10:03:37Z leonardo $
% Identity-UTF16-H CMap
% An identity mapping of UTF16 codes to CIDs./CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo 3 dict dup begin
/Registry (Artifex) def
/Ordering (Unicode) def
/Supplement 0 def
end def/CMapName /Identity-UTF16-H def
/CMapVersion 1.000 def
/CMapType 1 def/UIDOffset 0 def
% No XUID yet obtained./WMode 0 def
1 begincodespacerange
endcodespacerange
1 begincidrange
0
endcidrange
endcmap
CMapName currentdict /CMap defineresource pop
end
end%%EndResource
%%EOF
And it is working !!! Woot !
Mots-clés: mac folder icon, mac folder, thomas genin, mac applications icon, applications icon mac










