I'm trying to process a PDF with ghostscript 9.05 that contains an image. The original PDF displays fine in Adobe Acrobat Reader 9 as well as Ubuntu's built in Document Viewer. When running the file through Ghostscript I get: **** Warning: File encountered 'rangecheck' error while processing an image. Loading NimbusSanL-ReguItal font from /usr/share/fonts/type1/gsfonts/n019023l.pfb... 4342240 2931231 2721360 1395616 3 done. **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> Prawn <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification. The image is then removed from the output PDF. I've tried to recreate this by creating other PDFs with an embedded image using Prawn, but have not been able to reproduce. Is there some way to get ghostscript to autocorrect or fix issues like these? The Prawn generated PDF: https://s3.amazonaws.com/test-filestore/image.pdf The image that is embedded: https://s3.amazonaws.com/test-filestore/signature.png
This happens with 9.05 and 9.07. Same issue.
The file works fine with gs 9.06 on fedora (64-bit). Evince works too. xpdf shows a black box. The one thing interesting about the pdf seems to be that it has an RGB image with 16-bit per component.
For future reference, *please* attach specimen files to the bug report rather than supplying a URL. It can sometimes be a while before we get round to looking at a problem, and the URL is often no longer valid. That can't happen if you attach the file. Like Hin-Tak I am unable to reproduce a problem on Windows or Linux, 32 or 64 bits. Given that you are working on Linux, and you haven't said where you got Ghostscript from) my suspicion is that your distribution is using shared libraries. This can be a problem as Ghostscript uses patched versions of some 3rd party libraries to fix problems we encounter. (we do supply these upstream but it can take some time for them to be adopted, and be reflected in OS distributions). I'm assuming above that you didn't get Ghostscript binaries from our site: http://www.ghostscript.com/download/gsdnld.html I'd suggest that you download Ghostscript form there or if you are comfortable with building applications I would suggest you download the Ghostscript source code (either the released 9.07 or the current HEAD in Git), build that and try it. That code comes with all the third party libraries ready to build and includes them statically. I expect that will work for you. Please let us know how you get on.
I downloaded source and built it from http://www.ghostscript.com/download. Still having the issue on Ubuntu 12.04. Here is the exact command I'm issuing: ./gs -o output.pdf -dPDFFitPage -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -sDEVICE=pdfwrite image.pdf I've uploaded the files from s3 to this ticket directly.
Created attachment 10018 [details] image.pdf
Created attachment 10019 [details] signature.png
(In reply to comment #4) ... > Here is the exact command I'm issuing: > > ./gs -o output.pdf -dPDFFitPage -dDEVICEWIDTHPOINTS=612 > -dDEVICEHEIGHTPOINTS=792 -sDEVICE=pdfwrite image.pdf ... You could have saved us a bit of time if you had written that at the beginning. The problem is not the image, but pdfwrite. With png16m or pxlcolor (as well as x11 I tried, & window display). The rangecheck is thrown by pdfwrite. This should be reassigned to the 'PDF Writer' component and goes to Ken.
(In reply to comment #7) > The rangecheck is thrown by pdfwrite. This should be reassigned to the 'PDF > Writer' component and goes to Ken. That's an easy one, pdfwrite doesn't support 16 bpc images at the moment, hence the rangecheck. I am part way through converting 16 to 8 for export, but not completed it yet.
I thought we had an open bug for this already, but it seems not, so I modified this one to be a placeholder for it. Eventually it'll get fixed as part of the colour work.
*** Bug 694964 has been marked as a duplicate of this bug. ***
commit baecaed381a6799e71c451933c3a1707f5653782 fixes this, provided the ColorConversionStrategy is 'LeaveColorUnchanged'
I'm still having this issue with version 9.10 and 9.14 compiled on amd64 (ubuntu 12.04). My command: gs -o output.pdf -dPDFFitPage -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -sColorConversionStrategy='LeaveColorUnchanged' -sDEVICE=pdfwrite image.pdf What am I doing wrong? Also, I didn't know how to reopen this ticket, so I marked as awaiting review? Thanks!
(In reply to Josh from comment #12) > I'm still having this issue with version 9.10 and 9.14 compiled on amd64 > (ubuntu 12.04). Its in the latest code, it was added on June 10th according to the comments. So no, it won't be in 9.14 (or 9.10) because that was released prior to that date. The next release (9.15) is expected in September. > My command: gs -o output.pdf -dPDFFitPage > -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 > -sColorConversionStrategy='LeaveColorUnchanged' -sDEVICE=pdfwrite image.pdf You don't actually need to specify the colour conversion strategy as LeaveColorUnchanged, as that is the default. Using your command line and input file I get a PDF file which can be opened without complaint by Adobe Acrobat X and Ghostscript. > What am I doing wrong? Did you recompile form the current source ? Are you sure you used the correct recompiled binary (I know, its obvious, but....) ? What is the SHA of the source you used ?
Yes, you are correct. I'll build from source and try again. Thanks!