Closed hannob closed 6 years ago
Thank you for reporting this bug! Fixed in 69c6b22728f2e3c1fe33b26fcee189167bbcd6d4. Upgrade to the latest pdfsizeopt.
The bug was triggered when an image object had its /Width
or /Height
as a reference (... ... R
).
Ah, great, @pts. This means that (at least in part), pdfsizeopt is able to inline objects like integers (one step closer to what Multivalent does, right?).
pdfsizeopt is inlining objects in some cases (e.g. /Length' values, image
/Width, image
/Height` values and other image values used by image recompression).
It would be awesome to add an optimization which inlines every non-stream object which is used only once (or twice... if it's small enough), restricted to those object types which the PDF specification allows to be inlined. Writing the Python code for the inlining is relatively easy, but compiling a full and reliable list of what is allowed to be inlined is the tedious part. You may want to file a separate issue for this.
The attached PDF will cause an AssertionError with pdfsizeopt. The file is produced by a brother scanner (DCP-135C) and it seems to use CCITT encoded image data (black/white images). pdf-blank-page.zip
With latest pdfsizeopt I get an error like this: