im trying to use ghostscript to compress a PDF file
but when i add the option -c ".setpdfwrite <</AlwaysEmbed [ ]>> setdistillerparams"
then ghostscript throws Error: /undefined in .setpdfwrite
so either a compile-time feature of ghostscript is missing
or a runtime dependency is missing
$ gs -sDEVICE=pdfwrite -o output.pdf -c ".setpdfwrite <</AlwaysEmbed [ ]>> setdistillerparams" -f input.pdf
GPL Ghostscript 10.01.1 (2023-03-27)
Copyright (C) 2023 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Error: /undefined in .setpdfwrite
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:768/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 10.01.1: Unrecoverable error, exit code 1
im trying to use ghostscript to compress a PDF file but when i add the option
-c ".setpdfwrite <</AlwaysEmbed [ ]>> setdistillerparams"
then ghostscript throwsError: /undefined in .setpdfwrite
so either a compile-time feature of ghostscript is missing or a runtime dependency is missing
based on https://stackoverflow.com/questions/10450120/optimize-pdf-files
what causes the
No such file or directory
error?strace
many "no such file" errors for the file
Decoding/Unicode
, which is provided byghostscriptX
in nixpkgsbut ghostscriptX fails too