Home > Back-end >  Am I doing something wrong in gswin64c sDEVICE=pdfwrite?
Am I doing something wrong in gswin64c sDEVICE=pdfwrite?

Time:11-10

I've been using Ghostscript in the command line with

gswin64c sDEVICE=pdfwrite -o out.pdf in.pdf

for a long time now with great success. Ghostscript's location is added to the Path variable setting in Windows 10. And today all of a sudden it stopped to work giving the following error message:

GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 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: /undefinedfilename in (sDEVICE=pdfwrite)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:762/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 9.55.0: Unrecoverable error, exit code 1

What I've tried so far

  • update Ghostscript from 9.54 to 9.55.0
  • different input file
  • rename input file
  • different folder containing the input file
  • copying the input file to the \gs9.55.0\bin\ folder
  • running the command line with admin privs
  • running windows logged in as admin

All to no success and always giving me the same error message. All the files tried are being displayed correctly in any pdf viewer.

What am I doing wrong here? And why suddendly?

CodePudding user response:

Easily done but read the error undefinedfilename in (sDEVICE=pdfwrite)

Whilst not very clear, it thinks you are asking for that file to be processed.

However you should have just like for the -o output file switch added the switch - signal.

Then if there is no IN file the message changes

gswin64c -sDEVICE=pdfwrite -o out.pdf in.pdf

GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 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: /undefinedfilename in (in.pdf)

Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:764/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 9.55.0: Unrecoverable error, exit code 1

Just a side note that it can sometimes reduce later issues if you get into the habit of using

gswin64c -sDEVICE=pdfwrite -o"out.pdf" -f"in.pdf"

  • Related