Bug 692903 - PDF File Renders Badly
Summary: PDF File Renders Badly
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.04
Hardware: PC Linux
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
: 692905 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-06 16:30 UTC by Ben Rousch
Modified: 2012-03-07 19:21 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
42x30 blueprints (4.63 MB, application/pdf)
2012-03-06 16:30 UTC, Ben Rousch
Details
Screenshot of scrambled PDF (276.10 KB, image/png)
2012-03-06 18:34 UTC, Ben Rousch
Details
output file (2.59 MB, image/png)
2012-03-06 19:05 UTC, Ken Sharp
Details
Scrambled output from provided ghostscript command (1.46 MB, image/png)
2012-03-06 19:10 UTC, Ben Rousch
Details
Scrambled output from gs command on Debian 6.0.4 with gs 8.64 (1.21 MB, image/png)
2012-03-06 20:40 UTC, Ben Rousch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Rousch 2012-03-06 16:30:48 UTC
Created attachment 8402 [details]
42x30 blueprints

The attached PDF renders correctly in Adobe Reader X, Foxit Reader 5.1, Okular 4.7.4, and Evince 3.2.1, but it doesn't render correctly using Ghostscript 8.4 (Windows) or Ghostscript 9.04 (Ubuntu Linux 11.10).
Comment 1 Ken Sharp 2012-03-06 17:04:30 UTC
This is a 34 page PDF file, which page do you see a problem ? 

What is the nature of the problem ? "Bad rendering", while descriptive, doesn't tell the developer much, and on a huge page it will be much easier to find the problem if you can say *where* on the page it is.

What Ghostscript command line are you using ?
Comment 2 Ben Rousch 2012-03-06 17:11:39 UTC
The problem is on any of the pages. The entire page appears scrambled with letters and symbols scattered seemingly at random.

I am using Ghostscript behind Imagemagick, so I'm not sure exactly how it's called. However you can easily see the problem by using the gs command to view the page and comparing that to one of the other PDF viewers.
Comment 3 Ken Sharp 2012-03-06 17:38:39 UTC
(In reply to comment #2)
> The problem is on any of the pages. The entire page appears scrambled with
> letters and symbols scattered seemingly at random.

I don't see this at all.
 
> I am using Ghostscript behind Imagemagick, so I'm not sure exactly how it's
> called. However you can easily see the problem by using the gs command to view
> the page and comparing that to one of the other PDF viewers.

Not what I see. For example the file you sent, on page 1 has the text 'Purdue University Discovery Park' at the top (or right if the page is rotated for reasonable reading) just under the engineers signature. Other text on the page appears correct as well.

If you can't supply a means for us too reproduce your problem, then I'm afraid we can't fix it. You could try using the current release (9.05) instead of an older version but that's all I can suggest. I believe it is possible to retrieve the command ImageMagick is using, but I have no idea how to go about it.
Comment 4 Ben Rousch 2012-03-06 18:34:01 UTC
Created attachment 8405 [details]
Screenshot of scrambled PDF

A screenshot of page 1 of the original PDF showing the scrambling.
Comment 5 Ben Rousch 2012-03-06 18:35:15 UTC
I tried Ghostscript 9.05 and had the same scrambled result. I have attached a screenshot to demonstrate what I am seeing.
Comment 6 Robin Watts 2012-03-06 19:00:33 UTC
I'm pretty sure you were running 9.04 when you took that screenshot...
Comment 7 Ken Sharp 2012-03-06 19:05:04 UTC
Created attachment 8406 [details]
output file

(In reply to comment #5)
> I tried Ghostscript 9.05 and had the same scrambled result. I have attached a
> screenshot to demonstrate what I am seeing.

That's quite different to what I see. How sure are you that ImageMagick is using the installed version of Ghostscript and not some earlier version ?

I'm afraid that unless you can give us a means to reproduce this with Ghostscript itself, we can't help.

This command line:

gs -sDEVICE=png16m -r72 -dFirstPage=1 -dLastPage=1 -o out.png Add_3_Bugs.pdf

produces the attached PNG output from current code.
Comment 8 Ben Rousch 2012-03-06 19:09:23 UTC
My screenshot is from 9.04, but the result is the same in 9.05. I booted into an Ubuntu 12.04 LiveCD to try Ghostscript 9.05.
Comment 9 Ben Rousch 2012-03-06 19:10:47 UTC
Created attachment 8407 [details]
Scrambled output from provided ghostscript command

This is the PNG file produced from the gs command you suggested.
Comment 10 Ken Sharp 2012-03-06 19:25:30 UTC
I wonder if this is a third party problem, given that Ubuntu insist on building Ghostscript with shared libraries. I would suggest building Ghostscript from source and trying that so that you get our versions of the libraries rather than using the system ones.

As you can see, your experience differs from mine and I can't reproduce your results.
Comment 11 Ben Rousch 2012-03-06 20:40:53 UTC
Created attachment 8408 [details]
Scrambled output from gs command on Debian 6.0.4 with gs 8.64

This scrambled PNG was produced by the original PDF and suggested gs command using Debian 6.0.4 with Ghostscript 8.71.
Comment 12 Chris Liddell (chrisl) 2012-03-06 21:09:27 UTC
The file contains JBIG2 images. Your distribution's jbig2dec code is out of date compared to that in the latest Ghostscript release.

There is some resistence to continuing jbig2dec as a separate "product" as we are not aware of any other projects which use it.
Comment 13 Ben Rousch 2012-03-06 21:23:54 UTC
It looks like I have jbig2dec 0.11-1ubuntu1 installed, which is newer than the current version according to http://jbig2dec.sourceforge.net/

Is there a better version that I and Ubuntu should be using?
Comment 14 Ben Rousch 2012-03-06 21:52:40 UTC
I cloned and installed jbig2dec from here http://git.ghostscript.com/?p=jbig2dec.git . It now reports version 0.11pre. This seems to have had no effect.
Comment 15 Chris Liddell (chrisl) 2012-03-06 23:04:11 UTC
The jbig2dec in the Ghostscript repository is the latest code (it will still say 0.11 as it hasn't been formally released as a standalone package).
Comment 16 Ben Rousch 2012-03-07 19:21:39 UTC
*** Bug 692905 has been marked as a duplicate of this bug. ***