lcorbasson / pdfsizeopt

Automatically exported from code.google.com/p/pdfsizeopt
0 stars 0 forks source link

[REGRESSION] Revision 230 makes ghostscript bomb #86

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, Péter.

With revision 230, I have a problem while optimizing one file, which I did not 
have with revision 229:

rbrito@zatz:~/Desktop$ ~/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py 
f-wescot.pdf 
info: This is pdfsizeopt.py rUNKNOWN size=321664.
info: using Java for Multivalent: /usr/bin/java
info: loading PDF from: f-wescot.pdf
info: loaded PDF of 299155 bytes
info: separated to 284 objs + xref + trailer
info: found 0 Type1 fonts loaded
info: found 15 Type1C fonts loaded
info: writing Type1CParser (36904 font bytes) to: pso.conv.parse.tmp.ps
info: using Ghostscript gs: GPL Ghostscript 9.05 (2012-02-08)
info: executing Type1CParser with Ghostscript: gs -q -dNOPAUSE -dBATCH 
-sDEVICE=nullpage -sDataFile=pso.conv.parsedata.tmp.ps -f pso.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 905 20120208
Type1CParser: all OK
info: parsed 15 Type1C fonts
info: eliminated 3 unused objs in 3 classes
info: saving PDF with 281 objs with Multivalent to: f-wescot.psom.pdf
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: generated object stream of 6716 bytes in 147 objects (12%)
info: written 266273 bytes to Multivalent input PDF: pso.conv.mi.tmp.pdf
info: executing Multivalent to optimize PDF: /usr/bin/java -cp 
/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/Multivalent.jar 
-Djava.awt.headless=true tool.pdf.Compress -nopagepiece -noalt -mon 
pso.conv.mi.tmp.pdf
file:/home/rbrito/Desktop/pso.conv.mi.tmp.pdf, 266273 bytes
PDF 1.5, producer=Acrobat Distiller 4.05 for Macintosh, creator=null
284 objects / 14 pages, liftPageTree, inline 2
cleaned and modernized
additional compression may be possible with:
     -compact
write => new length = 259844, saved 2%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 259867 bytes (98%)
info: decompressing 691 bytes with Ghostscript /Filter<built-in function 
filter>/DecodeParms <</Predictor 12/Columns 5>>
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
Traceback (most recent call last):
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 8089, in <module>
    main(sys.argv)
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 8082, in main
    is_flate_ok=not do_decompress_flate)
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 7788, in Save
    data=multivalent_output_data, output=output, **job[0])
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 7362, in FixPdfFromMultivalent
    w0, w1, w2, unused_index, xref_data = trailer_obj.GetXrefStream()
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 1471, in GetXrefStream
    xref_data = self.GetUncompressedStream()
  File "/home/rbrito/Desktop/mirrors/pdfsizeopt/trunk/pdfsizeopt.py", line 2402, in GetUncompressedStream
    gs_defilter_cmd, data)
AssertionError: Ghostscript decompression failed: gs -dNODISPLAY 
-sINFN=pso.filter.tmp.bin -q -c '/i INFN(r)file<</CloseSource true /Intent 
2/Filter <built-in function filter>/DecodeParms <</Predictor 12/Columns 
5>>>>/ReusableStreamDecode filter def /o(%stdout)(w)file def/s 4096 string def 
{i s readstring exch o exch writestring not{exit}if}loop o closefile quit' 
('Error: /syntaxerror in -file-\nOperand stack:\n   i   --nostringval--   
--nostringval--   CloseSource   true   Intent   2   Filter\nExecution stack:\n  
 %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-- 
  2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   
false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   
--nostringval--   2   %stopped_push\nDictionary stack:\n   
--dict:1162/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--\nCurrent 
allocation mode is local\n')
rbrito@zatz:~/Desktop$ 

The file in question is:

    http://www.embedded.com/ContentEETimes/Documents/Embedded.com/2000/f-wescot.pdf

Thanks.

Original issue reported on code.google.com by rbr...@gmail.com on 8 Mar 2013 at 7:46

GoogleCodeExporter commented 8 years ago
Thank you for reporting this. It was a silly variable renaming bug. Fixed in 
r231.

Original comment by pts...@gmail.com on 8 Mar 2013 at 9:07

GoogleCodeExporter commented 8 years ago

Original comment by pts...@gmail.com on 8 Mar 2013 at 9:07

GoogleCodeExporter commented 8 years ago
(I tried to send this via e-mail, but apparently, the message was not delivered)

Hi Peter.

I just tested and this revision indeed brought things back to work.

Thanks this quick fix.

Original comment by rbr...@gmail.com on 8 Mar 2013 at 11:48