views:

97

answers:

2

I tried

gswin32c -sDEVICE=jpeg -sOutputFile=foo.jpg foo.pdf

but I get the ff. output from Ghostscript on the page where the Chinese font is used.

Substituting CID font resource/Adobe-CNS1 for /·s²Ó©úÅé.
Error: /undefinedresource in --findresource--
Operand stack:
   --dict:4/4(L)--   F3   12.96   --dict:6/6(L)--   --dict:6/6(L)--   ·s²Ó©úÅé --dict:9/12(ro)(G)--   --nostringval--   --dict:8/8(L)--   --dict:8/8(L)--   Adobe-CNS1   CIDFont   Adobe-CNS1
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--   3   1   33   --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--   12   9   %oparray_pop   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1122/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:26/31(L)--   --dict:20/26(ro)(G)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.54: Unrecoverable error, exit code 1

It's obvious that Ghostscript's encoding is non-Unicode because it got garbage (/·s²Ó©úÅé) when it read the font name which is in Chinese. Here is a screen shot of the Chinese fonts used as listed by Adobe Reader 9.

A: 
pipitas
You seem to be right that it is a code page problem. I used 65001 and the font name became an undisplayed glyph. However, I still got the same error. On the other hand, I've been thinking about the error and it seems that you are right again that it is Adobe-CNS1 that was not located. It's strange though because AFAIK this comes shipped with GS.
Chry Cheng
@Chry Cheng: Is your Ghostscript running on the same system as where you made your Acrobat screenshot (http://imgur.com/4mdmx.png) with the chinese font name?
pipitas
If Ghostscript is printing Unicode, then the Windows console aill handle codepage conversions automatically. You'll see question marks in that case, then. When using UTF-8 it's more likely that the results are simply U+FFFD, what unknown code points are converted into. (Indeed, when interpreting above characters as they would appear in code page 850 or 437 as UTF-8 I get only gibberish. This is definitely *not* the problem here.)
Joey
@pipitas: Yes, that's correct.
Chry Cheng
A: 
pipitas
@pipitas: I didn't know MuPDF yet. I downloaded+installed in an instance after reading your answer, and indeed: it is **really** fast (and **very** spartanic in its GUI).
@pipitas: I require a DLL interface which MuPDF does not seem to have.
Chry Cheng
@Chry Cheng: *"MuPDF is a lightweight PDF viewer and toolkit written in portable C. [...] small footprint. A binary [...] with full CJK support (including an Asian font) is approximately five megabytes. [...] support for all non-interactive PDF 1.7 features [...] provides a simple API for accessing the internal structures of the PDF document. Example code for navigating interactive links and bookmarks, encrypting PDF files, extracting fonts, images, and searchable text, and rendering pages to image files is provided."* (Quote from README)
pipitas