问题
To solve my problem here with compressing/down-sizing a PDF file generated by MikTeX on Windows, I am trying this bash script on Cmder as:
shrinkpdf.sh in.pdf > out.pdf
However I get the error:
Invalid value for option -dPDFSETTINGS=C:/Program Files/Git/screen, use -sNAME= to define string constants
which I suppose has to do with the line
-dPDFSETTINGS=/screen
I would appreciate it if you could help me know what is the problem and how I can solve it.
My environment is:
- Windows OS:
1809
- Cmder:
1.3.14
- Ghostscript:
9.27
回答1:
I ran into the same issue and I fixed it using a double slash: "//screen" instead of "/screen". This is due to mingw that is trying to be smart and replace "/" with GIT home directory.
Reference: https://github.com/moby/moby/issues/24029#issuecomment-250412919
回答2:
This does not appear to be a Ghostscript problem. It seems to be something to do with your script, presumably some kind of argument replacement or expansion.
Claearly this:
-dPDFSETTINGS=C:/Program Files/Git/screen
is incorrect, but that's nothing to do with Ghostscript. I suspect you neeed to quote that argument or something like that, so that your shell doesn't meddle with it.
来源:https://stackoverflow.com/questions/59900205/ghostscript-on-windows-leads-to-invalid-option-for-dpdfsettings