I am using Ghostscript to print a PDF by command line arguments. But it shows the printed document\'s name as Ghostscript output in printer spooler. I want to change it to a
This provides a partial solution to the issue, which is perhaps acceptable for your needs.
The options to control the output size are (markdown inserts spaces, but there should be none):
-dDEVICEWIDTHPOINTS=
w
, -dDEVICEHEIGHTPOINTS=
h
(w,h=595,842 / 612,792 for A4 / letter, respectively), Ref.
-sPAPERSIZE=
size
, Ref.
-g
number1
x
number2
(number1,number2=5953,8419 / 6120,7920 for A4 / letter, respectively), Ref.
-dDEVICEWIDTH=
number1
, -dDEVICEHEIGHT=
number2
(number1,number2=5953,8419 / 6120,7920 for A4 / letter, respectively), Ref.
I have tested the four of them, printing a pdf file to pdf, trying to convert (letter -> A4) and (A4 -> letter). The command line I used is
gswin32c -dPDF -dBATCH -dNOPAUSE -dFIXEDMEDIA -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
A4 -> letter always worked well.
letter -> A4 only worked for the width, so output.pdf
was always 210mm x 279.4mm.
Using, e.g., -dDEVICEWIDTHPOINTS
alone for letter -> A4 produced the same result.
Adding flag -dPDFFitPage
was also useful for partially adapting size (in cases I want to do that).
My conclusion is that there is some bug in Ghostscript specifically related to letter -> A4 conversion. Whether this could be handled via gs_setpd.ps
(e.g., this; this would still be a bug), or a crafty combination of (-dUseBleedBox
, -dUseTrimBox
, -dUseArtBox
, -dUseCropBox
) I don't know.