converting a pdf with japanese fonts

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
time

converting a pdf with japanese fonts

Post by time »

Hi,
I am trying to convert a pdf that has japanese in it into a jpg under windows 2003 server.
The pdf has some cid fonts
I looked at the pdf doc's property. Thefollowing is an example font in it:

MS-PGothic
Type: TrueType (CID)
Encoding: Identity-H
Acutal Font: MSPGothic
Actual Font Type: TrueType

I ran the following
Q:\PDFTools\test2\convert Q:\PDFTools\test3\36746514.pdf[0] Q:\PDFTools\test3\36746514.jpg

and got this error message:

Error: /undefined in findresource
Operand stack:
--dict:9/18(L)-- TT6 1 --dict:5/5(L)-- --dict:5/5(L)-- MS-Mincho
--dict:11/12(ro)(G)-- --nostringval-- CIDFontObject --dict:7/7(L)-- --di
ct:7/7(L)-- Adobe-Japan1
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-
- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- fa
lse 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_
pop 1845 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-- --nos
tringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval
-- %array_continue --nostringval-- --nostringval-- --nostringval-- --n
ostringval-- --nostringval-- %loop_continue
Dictionary stack:
--dict:1161/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75
/200(L)-- --dict:106/127(ro)(G)-- --dict:285/300(ro)(G)-- --dict:23/25(L)-
- --dict:4/6(L)-- --dict:26/40(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
convert: `%s': %s "q:/myprogs/gs/gs8.70/bin/gswin32c.exe" -q -dQUIET -dPARANOIDS
AFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixel
s=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r7
2x72" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/DOCUME~1/T~1.CHA/LOCALS~1
/Temp/1/magick-b96qrM4v" "-fC:/DOCUME~1/THOMAS~1.CHA/LOCALS~1/Temp/1/magick-_E3U
59lX" "-fC:/DOCUME~1/T~1.CHA/LOCALS~1/Temp/1/magick-_DycJJYs" @ pdf.c/Invok
ePDFDelegate/197.
convert: Postscript delegate failed `Q:\PDFTools\test3\36746514.pdf': No such fi
le or directory @ pdf.c/ReadPDFImage/634.
convert: missing an image filename `Q:\PDFTools\test3\36746514.jpg' @ convert.c/
ConvertImageCommand/2822.

I downloaded and installed the Japanese Font support for Adobe acrobat and can view the pdf with acrobat, but i keep getting this error with ImageMagick's convert utility.
Anybody know how i can fix this?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: converting a pdf with japanese fonts

Post by anthony »

It isn't IM that needs to be fixed, but ghostscript that IM calls to convert PDF to some image format. It is also the source of the errors you are seeing.

Try
gs Q:\PDFTools\test3\36746514.pdf
to see the ghostscript output directly (on screen) return in the terminal window goes to next page.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
time

Re: converting a pdf with japanese fonts

Post by time »

When i try to open the pdf document with ghostscript.
This is the error I am getting.
Why is it not able to find MS-Mincho? I have the font installed.
How does it know which font (Adobe-Japan1) to substitute for?


PL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Substituting font Times-Bold for TimesNewRomanPS-BoldMT.
Loading NimbusRomNo9L-Medi font from %rom%Resource/Font/NimbusRomNo9L-Medi... 23
38808 1009655 11430040 10083126 3 done.
Can't find CID font "MS-Mincho".
Substituting CID font /Adobe-Japan1 for /MS-Mincho, see doc/Use.htm#CIDFontSubst
itution.
The substitute CID font "Adobe-Japan1" is not provided either. Will exit with er
ror.
Error: /undefined in findresource
Operand stack:
--dict:9/18(L)-- TT6 1 --dict:5/5(L)-- --dict:5/5(L)-- MS-Mincho
--dict:11/12(ro)(G)-- --nostringval-- CIDFontObject --dict:7/7(L)-- --di
ct:7/7(L)-- Adobe-Japan1
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-
- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- fa
lse 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_
pop 1845 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1
2 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval--
--nostringval-- --nostringval-- %array_continue --nostringval-- false
1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nos
tringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval
-- %array_continue --nostringval-- --nostringval-- --nostringval-- --n
ostringval-- --nostringval-- %loop_continue
Dictionary stack:
--dict:1152/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75
/200(L)-- --dict:106/127(ro)(G)-- --dict:285/300(ro)(G)-- --dict:23/25(L)-
- --dict:4/6(L)-- --dict:26/40(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.70: Unrecoverable error, exit code 1

Close this window with the close button on the title bar or the system menu.
white_raven

Re: converting a pdf with japanese fonts

Post by white_raven »

Time!
Fedora 11...same problem

1) installed Japanese-support
yum groupinstall japanese-support

2) downloaded fonts from here
http://www.linux.ryukent.co.uk/show.php?id=24
That gives you MS-Mincho and MS Gothic (Microsoft TryeType fonts)

3) then I found a conf.d directory with cidfmap.ja file where you can specify the substitution font Adobe-Japan1 and Adobe-Japan2

Code: Select all

/MSGothic  << /FileType /TrueType /Path (/usr/share/fonts/truetype/msjapanesefonts/MSGOTHIC.TTF) /CSI [(Japan1) 2] >> ;
/MSMincho << /FileType /TrueType /Path (/usr/share/fonts/truetype/msjapanesefonts/MSMINCHO.TTF) /CSI [(Japan1) 2] >> ;

/Adobe-Japan1           /MSGothic ;
/Adobe-Japan2           /MSGothic ;
that was it, gs would not complain about not finding a source
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: converting a pdf with japanese fonts

Post by anthony »

GS does not use true type fonts! It uses postscript fonts.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
white_raven

Re: converting a pdf with japanese fonts

Post by white_raven »

you can kinda force it to use TryeType
example

Code: Select all

% comment out MSGothic 
%/MSGothic  << /FileType /TrueType /Path (/usr/share/fonts/truetype/msjapanesefonts/MSGOTHIC.TTF) /CSI [(Japan1) 2] >> ;
/MSMincho << /FileType /TrueType /Path (/usr/share/fonts/truetype/msjapanesefonts/MSMINCHO.TTF) /CSI [(Japan1) 2] >> ;
% lets use Arial Narrow instead of MSGothic or MSMincho
/MSArialn              << /FileType /TrueType /Path (/usr/share/fonts/truetype/msjapanesefonts/ARIALN.TTF) /CSI [(Japan1) 2] >> ;
% sub font for MSGothic is now MSArialn - we still need to have MSGothic or gs will complain 
/MSGothic               /MSArialn ;

/Adobe-Japan1           /MSGothic ;
/Adobe-Japan2           /MSGothic ;
Worked for me, finally I have good looking conversion for Japanese pdfs
my600080
Posts: 13
Joined: 2010-06-11T12:41:30-07:00
Authentication code: 8675308

Re: converting a pdf with japanese fonts

Post by my600080 »

Hi,

I'm having a similar error while converting a pdf file. I have tried various ways to fix it but I must have done something wrong. The problem just cannot be fixed. Can you tell me the detailed step of doing this? I have added the entry in cidfmap file but things just won't work. Thanks!

/TimesNewRoman << /FileType /TrueType /Path (/usr/X11R6/lib/X11/fonts/truetype/times.ttf) /SubfontID 0 /CSI [(Unicode) 0] >> ;

gs myfile.pdf

Can't find CID font "TimesNewRoman".
Substituting CID font /Adobe-Identity for /TimesNewRoman, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. Will exit with error.
Error: /undefined in findresource
Operand stack:
--dict:8/17(L)-- C2_4 1 --dict:5/5(L)-- --dict:5/5(L)-- TimesNewRoman,Bold --dict:11/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 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 3 --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-- --nostringval-- %loop_continue
Dictionary stack:
--dict:1146/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:106/127(ro)(G)-- --dict:285/300(ro)(G)-- --dict:22/25(L)-- --dict:4/6(L)-- --dict:26/40(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
Post Reply