Created attachment 6631 [details] Problematic pdf file I tried to use the following command on my pdf (generated with pdflatex): gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=test.pdf -c "<< /NeverEmbed [false /Times-Roman /Times-Bold /Courier-Bold] >> setdistillerparams" -f poster-extended-abstract.pdf with my gs (Ubuntu 10.4), I get: GPL Ghostscript 8.71 (2010-02-10) Copyright (C) 2010 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 2. Page 1 Error: /rangecheck in --run-- Operand stack: --dict:7/16(L)-- File Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 2 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- Dictionary stack: --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:25/40(L)-- --dict:14/18(ro)(L)-- --dict:2/3(L)-- --dict:3/5(L)-- --dict:1/1(ro)(G)-- --dict:6/12(L)-- Current allocation mode is local Last OS error: 2 GPL Ghostscript 8.71: Unrecoverable error, exit code 1
The file generates a /rangecheck error on --.discardtransparencygroup-- for me when using Windows. Both the HEAD and 8.70 revisions. -sDEVICE=ppmraw also gives the same result for me, so its not specific to PDF touput. Re-assigning to Alex as a PDF interpreter initially, this may need to go to Michael if it turns out to be a transparency problem.
This problem appears first in r10200 | mvrhel | 2009-10-20 23:50:46 -0400 (Tue, 20 Oct 2009) | 72 lines Reintegration of gs_extendgraphic branch into trunk. If .pushextendedgstate is commented out, the file runs to completion. /q { ... % PDFusingtransparency {.pushextendedgstate cvx} if ... } def BTW, "PDFusingtransparency {.popextendedgstate cvx} if" should be, probably, done only for a valid Q, i.e. after the checks.
And why "cvx" ? Removing this fixes the bug.
Created attachment 6632 [details] patch Remove spurious "cvx" operators after .pushextendedgstate and .popextendedgstate . Do .popextendedgstate after checking that "Q" has a correspondingh "q". The latter is not necessary to fix this bug but may help when PDF file has extra "Q"s .
The patch has been committed as a rev. 11615. Regression testing shows no differences.