pts / pdfsizeopt

PDF file size optimizer
GNU General Public License v2.0
764 stars 66 forks source link

AssertionError in OptimizeType1CFonts #78

Closed sbibauw closed 6 years ago

sbibauw commented 6 years ago

Another AssertionError with the following file: W16-36.pdf

End of pdfsizeopt output:

(...)
info: optimized Type1 font XObject 5613,5647: new size=754 (34%)
info: optimized Type1 font XObject 5616,5648: new size=951 (34%)
info: found 109 Type1C fonts loaded
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/../Cellar/pdfsizeopt/HEAD-e4c50c8/bin/pdfsizeopt/__main__.py", line 1, in <module>
  File "/usr/local/bin/../Cellar/pdfsizeopt/HEAD-e4c50c8/bin/pdfsizeopt/m.py", line 6, in <module>
  File "/usr/local/bin/../Cellar/pdfsizeopt/HEAD-e4c50c8/bin/pdfsizeopt/pdfsizeopt/main.py", line 5500, in main
  File "/usr/local/bin/../Cellar/pdfsizeopt/HEAD-e4c50c8/bin/pdfsizeopt/pdfsizeopt/main.py", line 3814, in OptimizeType1CFonts
AssertionError
zsh: exit 1     pdfsizeopt "W16-36.pdf"
pts commented 6 years ago

Thank you for reporting this! Fixed in 56886fdd8af41c8f2a7f8bf544f8c8de7c0e1087.

Please note that the attached W16-36.pdf was invalid (corrupt), because one of its Type1C fonts had the /StemV value missing. Since pdfsizeopt doesn't need this value, the fix was changing the error (AssertionError in the bug report) to a warning.