Summary: | Garbled output - File has unbalanced q/Q operators (too many Q's) | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Miguel <miguel.onoro> |
Component: | PDF Interpreter | Assignee: | Ken Sharp <ken.sharp> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | 9.18 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Customer: | Word Size: | --- | |
Attachments: | Document that triggers the bug |
The important warning isn't the 'unbalanced q/Q operators', its the "**** Error reading a content stream. The page may be incomplete." That means something went badly wrong and the current content stream was discarded. After that, anything can happen. The page contains two shading dictionaries with a very unusual construction: 93 0 obj false endobj 94 0 obj false endobj 95 0 obj << /Matrix [ 0 0.212249994 4.7115202 0 1322.51001 127.264 ] /PatternType 2 /Shading << /AntiAlias true /ColorSpace /DeviceCMYK /Coords [ 36.9071007 135.098999 685.984009 135.098999 ] /Extend [ 93 0 R 94 0 R ] .... Normally I would expect the booleans to be inline in the Extend array, instead of indirect references. Having them as references simply makes the PDF file larger. I suppose this is more evidence of poor quality control at Adobe (since this file is created by the Adobe PDF Library). Still its legal, if silly, so its fixed in commit e174b0553e6e2d3bb641cbede1187dfe7979ae86 Thank you for your effort. I've built GS with this patch and now it works perfectly. Thanks again. |
Created attachment 12060 [details] Document that triggers the bug Greetings. I'm trying to convert the front page of a prominent spanish national newspaper, with a very wide print run, to PNG. The PDF is provided by the newspaper itself, no third parties. The resulting image (90% of times) is badly laid out: texts are flipped upside-down and images are randomly positioned. Note that GS works flawlessly for many other newspapers, so the issue is with this particular one. I attach the sample that I'm referring to. I can provide more samples if you wish. Also tested on GS 9.15, the result is the same. Thank you in advance, and thanks for this great software. Miguel. Command: gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -dDOINTERPOLATE -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sDEVICE=png16m -dFirstPage=1 -dLastPage=1 -r300 -sOutputFile=abc.png abc.pdf Message log: GPL Ghostscript 9.18 (2015-10-05) Copyright (C) 2015 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 **** Error reading a content stream. The page may be incomplete. **** File has unbalanced q/Q operators (too many Q's) **** **** File did not complete the page properly and may be damaged. **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> Adobe PDF Library 10.0.1 <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification.