Bug 692868 - Bad output writing PDF file
Summary: Bad output writing PDF file
Status: NOTIFIED DUPLICATE of bug 690832
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Marcos H. Woehrmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-21 02:52 UTC by Marcos H. Woehrmann
Modified: 2012-04-21 04:13 UTC (History)
0 users

See Also:
Customer: 210
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2012-02-21 02:52:52 UTC
The following command generates a PDF file with bad output with gs8.71.  The first page that contains bad output varies, but is always seen by page 500.

The customer supplied command line:

%gs32% -sDEVICE=pdfwrite  -dNOPAUSE  -dBATCH  -dNOSAFER  -dIgnoreDSCOrientation  -dQUIET  -dPDFSETTINGS=/printer -sFONTPATH="C:\demo_tst"  -sOutputFile=tt4.pdf RMK-5147.ps

Further details from the customer:

Note – we have only been able to replicate/expose this issue with the combination of the following 4 items:

1) A special line in the PS file with the flush command: 
    <</EndPage {0 ne {pop false} { pop flush true} ifelse} bind>> setpagedevice
2) Parameter:     -sFONTPATH="C:\demo_tst" or -sFONTPATH=.
3) Parameter:      -dIgnoreDSCOrientation
4) Parameter:     -dPDFSETTINGS=/printer

Later versions of Ghostscript, including 9.00 do not have any problem writing a correct PDF file.
Comment 1 Marcos H. Woehrmann 2012-02-21 06:20:16 UTC
I've tried bisecting twice to find this issue, both times this commit came up as the one that fixed the problem:

commit bfaf616f974a6569ff2f46823b6c4e3fd59a1ed3
Author: Alex Cherepanov <alex.cherepanov@artifex.com>
Date:   Sat Feb 27 20:24:13 2010 +0000

    Upgrade Adobe Glyph List to v. 2.0. AGL is used for character mapping in
    non-symbolic TrueType fonts in PDF files. Bug 691116.

This doesn't make sense and applying this commit doesn't fix the problem.  

I've tried running the command line with valgrind on a Linux box but nothing interesting is reported.  And running a DEBUG build under Windows doesn't change the output (though there are some ".\psi\igcstr.c(153): String pointer 0xa114cb[765] outout [0xa116b8..0xa116c6" messages produced).
Comment 3 Ken Sharp 2012-02-21 07:53:02 UTC
(In reply to comment #0)
> The following command generates a PDF file with bad output with gs8.71.  The
> first page that contains bad output varies, but is always seen by page 500.

Fixing this is likely to take weeks, given that the input file is more than 500 pages, and doesn't (apparently) fail in a deterministic fashion. Can you be more specific about 'bad output' ?

> Note – we have only been able to replicate/expose this issue with the
> combination of the following 4 items:

> 4) Parameter:     -dPDFSETTINGS=/printer

That's not a single parameter, its a collection of about half a dozen, maybe more.
 
> Later versions of Ghostscript, including 9.00 do not have any problem writing a
> correct PDF file.

So, upgrade ?
Comment 4 Marcos H. Woehrmann 2012-02-21 17:28:03 UTC
Reassigned to me to discuss using -dUseCIEColor with the customer and also to investigate the 32 bit Linux valgrind messages.
Comment 5 Marcos H. Woehrmann 2012-02-21 18:32:13 UTC
This was fixed by http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0bd3e960b37258e0dd1a99f5110783a37d479e70

Many thanks to Chris' good memory :-)
Comment 6 Marcos H. Woehrmann 2012-02-21 18:36:38 UTC

*** This bug has been marked as a duplicate of bug 690832 ***