pts / pdfsizeopt

PDF file size optimizer
GNU General Public License v2.0
750 stars 65 forks source link

Ghostscript 9.54 compatibility: Error: /undefined in .setpdfwrite #152

Closed jornamon closed 1 year ago

jornamon commented 3 years ago

Get the following error while trying to do the test optimization run proposed in "Installation instructions and usage on macOS"

Running on zsh macOS 11.5

The PDF used was the one you download while following the instructions. deptest.pdf

./pdfsizeopt deptest.pdf info: This is pdfsizeopt ZIP rUNKNOWN size=69734. info: prepending to PATH: /Users/jnadal/GoogleDrive/scripts/pdfsizeopt/pdfsizeopt_libexec info: loading PDF from: deptest.pdf info: loaded PDF of 36080 bytes info: separated to 25 objs + xref + trailer info: parsed 25 objs info: eliminated 2 unused objs, depth=9 info: found 2 Type1 fonts loaded info: writing Type1CConverter (31666 font bytes) to: /var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T/psotmp.26211.conv.tmp.ps info: using Ghostscript TMPDIR=/var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T TEMP=/var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T gs: GPL Ghostscript 9.54.0 (2021-03-30); see the file COPYING for details. info: executing Type1CConverter with Ghostscript: TMPDIR=/var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T TEMP=/var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T gs -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=/var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T/psotmp.26211.conv.tmp.pdf -f /var/folders/70/t5b_2sys45x01wtkh6zjb38h0000gn/T/psotmp.26211.conv.tmp.ps Error: /undefined in .setpdfwrite Operand stack:

Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:729/1123(ro)(G)-- --dict:0/20(G)-- --dict:91/200(L)-- Current allocation mode is local Current file position is 3820 GPL Ghostscript 9.54.0: Unrecoverable error, exit code 1 fatal: Type1CConverter failed, status=0x100

leovinus2001 commented 3 years ago

Same issue here. Same "gs" version

PS: Made it work. turns out, this repo is (a) old and (b) contains macOS 32 bit executables in pdfsizeopt_libexec/ As 32 bit exes are deprecated, you 'just' need to recompile all the binaries in pdfsizeopt_libexec/ That took an hour with going through .tar.gz , identifying projects, etc, but it does work. Sadly, while the compression works on the example file provided, it does not my issue at hand.

pts commented 1 year ago

It looks like pdfsizeopt is not compatible with Ghostscript 9.54. Ghostscript 9.05 is known to work. I will add more details soon.

pts commented 1 year ago

Please install pdfsizeopt by following the Installation instructions and usage on macOS section in https://github.com/pts/pdfsizeopt (it has been updated recently). By doing so, pdfsizeopt will use Ghostscript 9.05 bundled with it, and it will work.