Bug 692775 - Ghostscript is not able to render the attached PDF files
Summary: Ghostscript is not able to render the attached PDF files
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.04
Hardware: PC Linux
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-07 12:46 UTC by Till Kamppeter
Modified: 2012-01-07 22:18 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
printout.pdf (91.72 KB, application/pdf)
2012-01-07 12:46 UTC, Till Kamppeter
Details
printout_original.pdf (96.12 KB, application/pdf)
2012-01-07 12:48 UTC, Till Kamppeter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Till Kamppeter 2012-01-07 12:46:55 UTC
Created attachment 8251 [details]
printout.pdf

Original bug report:

https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/909331

Ghostscript is not able to render some PDFs due to a font substitution problem.

Running

gs printout_original.pdf

or

gs printout.pdf

shortly pops up a window in which parts of the page appear and then errors out like this

GPL Ghostscript 9.04 (2011-08-05)
Copyright (C) 2011 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Can't find CID font "ArialMT".
Substituting CID font /Adobe-Identity for /ArialMT, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. Will continue, but content may be missing.
   **** Warning: can't process font stream, loading font by the name.
Can't find CID font "ArialMT".
Substituting CID font /Adobe-Identity for /ArialMT, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. Will continue, but content may be missing.
   **** Error reading a content stream. The page may be incomplete.
Error: /typecheck in --run--
Operand stack:
   --dict:10/10(L)-- 1.0 1.0 --dict:10/10(L)-- 1 10 ArialMT 3.9 --dict:5/5(L)-- --dict:5/5(L)-- ArialMT --dict:10/12(ro)(G)-- --nostringval-- CIDFontObject --dict:6/6(L)-- --dict:6/6(L)-- 13 Adobe-Identity
Execution stack:
   %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
   --dict:1157/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82/200(L)-- --dict:108/127(ro)(G)-- --dict:291/300(ro)(G)-- --dict:23/30(L)-- --dict:6/8(L)-- --dict:21/40(L)-- --dict:20/25(L)-- --dict:1/1(ro)(G)-- --dict:3/5(L)-- --dict:6/15(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 9.04: Unrecoverable error, exit code 1

The PDF files are attached. System used is Ubuntu Oneiric (11.10), same happens with Precise (12.04 under development). Ghostscript is 9.04 with the patches to fix bug 692711, bug 692612, bug 692687, bug 692691, bug 692626, bug 692679, bug 692568, bug 692532, bug 692532.

As the original reporter tells that the bug only came up with a recent update (regression caused by an update) most probably one of the most recent patches (bug 692711, bug 692612, bug 692687, bug 692691) introduced this bug.
Comment 1 Till Kamppeter 2012-01-07 12:48:35 UTC
Created attachment 8252 [details]
printout_original.pdf
Comment 2 Till Kamppeter 2012-01-07 12:54:15 UTC
The problem seems to be independent of the output device and the resolution. It happens with the deafult output device (low-res X display) when using the shown commands and it happens with the "cups" output device (high resolution, used when the original reporter tried to print).
Comment 3 Hin-Tak Leung 2012-01-07 19:36:42 UTC
(In reply to comment #0)
> Created an attachment (id=8251) [details]
> printout.pdf
> 
> Original bug report:
> 
> https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/909331
> 
> Ghostscript is not able to render some PDFs due to a font substitution problem.
> 
> Running
> 
> gs printout_original.pdf
> 
> or
> 
> gs printout.pdf
> 
> shortly pops up a window in which parts of the page appear and then errors out
> like this
> 
> GPL Ghostscript 9.04 (2011-08-05)


Maybe you need this?

commit 0ab8cd1259dc76f6b3465f1ccd08a7509428e021
Author: Chris Liddell <chris.liddell@artifex.com>
Date:   Fri Aug 19 13:38:04 2011 +0100

    Reinstate Identity-UTF16-H and UniHojo-UCS2-H CMaps
    
    We need these in order to use Truetype fonts to emulate CIDFonts,
    see gs_ciddc.ps
    
    CLUSTER_UNTESTED
Comment 4 Chris Liddell (chrisl) 2012-01-07 20:02:17 UTC
I can't find a version of Ghostscript that doesn't error out on this file, unless you have an ArialMT CIDFont installed, or you have an ArialMT subsitute defined in your cidfmap file. 8.71, 9.02, and 9.04 all give error out without the CIDFont available.

So, I'm not clear how the file "worked" previously, unless the Ubuntu install included CIDFont substitutions.

Current master includes code to automatically subsitute DroidSansFallback.ttf for missing CIDFonts.
Comment 5 Till Kamppeter 2012-01-07 20:28:28 UTC
Hin-Tak, commit 0ab8cd1259dc76f6b3465f1ccd08a7509428e021 does not solve the problem for me. I still get the same error.
Comment 6 Till Kamppeter 2012-01-07 21:56:45 UTC
The problem is actually fixed in the GIT master of Ghostscript. Therefore I change the status to "FIXED".

To backport the fix BOTH the patches 0ab8cd1259dc76f6b3465f1ccd08a7509428e021 AND 18a5170163b690647f70d58e4c9d75873cd1324b need to get applied, and the file /usr/share/ghostscript/9.04/Resource/CIDFSubst/DroidSansFallback.ttf be installed (do not know which patch does it, I copied the file manually). Then the attached files render completely and do not error out. There are only warnings, but this is intended behavior.
Comment 7 Till Kamppeter 2012-01-07 22:18:25 UTC
According to the GIT log, the two patches seem to cause problems with pdfwrite (bug 690779), so applying patch 3875e5a471e3f9b9b4a2f5ea03e37b59fcd8913c is recommended when backporting the fix.