I have been using this code to reduce the size of a pdf file:

cd C:\Program Files\gs\gs9.25\bin
gswin64c.exe –h
Gswin64c –sDEVICE=pdfwrite –dCompatibilityLevel=1.4 –dPDFSETTINGS=/printer –dNOPAUSE –dQUIET –dBATCH –sOutputFile=D:\path\filename.pdf D:\path\compressed.pdf

I am working in Windows 8 command prompt. It was working just last week, but now when I type the gswin64c.exe -h command, I get this error:

GPL Ghostscript 9.25 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: See the file PUBLIC for details.

Error: /undefinedfilename in (\342\200\223h)
Operand stack:

Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push

Dictionary stack:
--dict:980/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.25: Unrecoverable error, exit code 1

Any help would be greatly appreciated.


You have an error in your script.

The line :

cd C:\Program Files\gs\gs9.25\bin

Should be :

cd "C:\Program Files\gs\gs9.25\bin"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.