Last current ghostscript git build (9.08) falls in endless error message loop with message **** File has unbalanced q/Q operators (too many Q's) **** See sample file in attachment. Command line sample: gswin32 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=test.png comp.pdf
Created attachment 9988 [details] sample file
It seems that the problem with image object stream parsing. Object name: /I7, reference: [4 0]. I ran script with PDFSTOPONERROR and PDFDEBUG and significant part of output is: ................................. q 129.780701 0 0 42.088 18.0 706.116699 cm /I7 Do %Resolving: [4 0] Error: /rangecheck in --.execform1-- Operand stack: --dict:6/15(L)-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- false --dict:12/20(L)-- --nostringval-- --nostringval-- DCTDecode --nostringval-- 0 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1932 1 3 %oparray_pop 1931 1 3 %oparray_pop 1915 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- %loop_continue --nostringval-- 154467 --nostringval-- 10 1 1874 6 11 %oparray_pop --nostringval-- false 1 %stopped_push 1873 6 11 %oparray_pop --nostringval-- (gstatetype) --dict:0/0(L)-- --nostringval-- --nostringval-- %loop_continue --nostringval-- 153338 --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- Dictionary stack: --dict:1176/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82/200(L)-- --dict:109/127(ro)(G)-- --dict:293/300(ro)(G)-- --dict:27/32(L)-- --dict:6/8(L)-- --dict:24/40(L)-- --dict:1/1(ro)(G)-- --dict:2/5(L)-- --dict:1/1(ro)(G)-- --dict:7/18(L)-- Current allocation mode is local Last OS error: No such file or directory Any suggestions please?
The basic problem is that your PDF file is broken. If you open it in Acrobat it also gives you an error. Until someone has the time to look at this, the only suggestion is to fix your PDF file. Note that I7 appears to be a DCT encoded image (JPEG), possibly there is something wrong with that data.
But this file successfully opens with Acrobat, mupdf and Chrome internal viewer for example. And, yes, I7 - encoded image stream object and it was successfully viewed with that programs. PDF producer of this file obviously is not good, but I can not affect for it quality.
(In reply to comment #4) > But this file successfully opens with Acrobat, mupdf and Chrome internal > viewer for example. Acrobat gives me an error when I open the file, MuPDF opens it mostly blank (on my version which is a bit old). I am not saying its not being addressed, but I have a long list of bugs to look at.
As anticipated, the PDF file is invalid. The image stream uses 2 filters ([/ASCII85Decode/DCTDecode]) *and* supplies a DecodeParams array ([<<>>]). The DecodeParams array is nonsense, since it has no parameters, and also invalid, the two arrays must have the same number of entries (or DecodeParams can be elided). If they are different we don't know which Params apply to which Filter. commit daceba62fcce274fc62e750ac186b3a9026554ad works around this broken file by testing the lengths of the 2 arrays and ignoring the DecodeParams if the two lengths differ. (we also emit a warning).
Thank you very much! Works perfectly.