hefronmedia / pdfsizeopt

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

zlib.error: Error -3 while decompressing: unknown compression method #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What command do you run to optimize the PDF?
user@ubuntu804server:~/manypdfs/fail2$ ~/pdfsizeopt/pdfsizeopt.py --use-
pngout=false --use-multivalent=true ../fail/pci64_board_ds.pdf kl.pdf

What does pdfsizeopt display when running the command above?
info: This is pdfsizeopt.py r132.
info: loading PDF from: ../fail/pci64_board_ds.pdf
info: loaded PDF of 112045 bytes
info: separated to 58 objs
info: found 0 Type1 fonts loaded
info: found 0 Type1C fonts loaded
Traceback (most recent call last):
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 6141, in ?
    main(sys.argv)
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 6127, in main
    pdf.OptimizeImages(use_pngout=use_pngout, use_jbig2=use_jbig2)
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 4827, in OptimizeImages
    colorspace, colorspace_has_changed = PdfObj.ResolveReferences(
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 2082, in 
ResolveReferences
    data = cls.PDF_REF_RE.sub(Replacement, data)
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 2059, in Replacement
    new_data = cls.PDF_REF_RE.sub(Replacement, new_data)
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 2069, in Replacement
    return obj.EscapeString(obj.GetUncompressedStream(objs=objs))
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 1962, in 
GetUncompressedStream
    return PermissiveZlibDecompress(self.stream)
  File "/home/user/pdfsizeopt/pdfsizeopt.py", line 120, in 
PermissiveZlibDecompress
    uncompressed = zlib.decompressobj().decompress(data)
zlib.error: Error -3 while decompressing: unknown compression method

What's wrong with the optimized PDF?

What should be there in the optimized PDF instead?

Original issue reported on code.google.com by lev.bishop on 17 Nov 2009 at 5:25

Attachments:

GoogleCodeExporter commented 9 years ago
This is an encrypted PDF (with an /Encrypt dictionary in its trailer). 
pdfsizeopt.py
cannot read encrypted PDFs. I'll add a more informative error message and some
documentation soon.

Original comment by pts...@gmail.com on 17 Nov 2009 at 6:30

GoogleCodeExporter commented 9 years ago
Merged to issue 51.

Original comment by pts...@gmail.com on 15 Apr 2012 at 7:51