I'm using the following Ghostscript command to convert an 8.5" x 17.00" (2:1) PDF to a PNG:
gswin32c.exe -sDEVICE=png16m -sNOPAUSE -sOutputFile="C:\output.png" -r120 -q -dBATCH "C:\input.pdf"
This command has worked well for me in the past, but with a given set of input PDFs it is adding whitespace to the bottom of the outputted PNG. The PNGs are coming out at 1080x2460 (18:41).
I also tried sDEVICE=pngalpha and it had the same result.
The image below shows the source PDF on the left, and the output PNG on the right:
Can anyone tell me what might cause this?
Thanks the comments by @KenS, and this SO question, I learned of these Ghostscript flags:
-dUseTrimBox
-dUseCropBox
-dUseArtBox
-dPDFFitPage
When I include -dUseCropBox
in the command, it works correctly:
gswin32c.exe -sDEVICE=png16m -dUseCropBox -sNOPAUSE -sOutputFile="C:\output.png" -r120 -q -dBATCH "C:\input.pdf"
Source: Obey the MediaBox/CropBox in PDF when using Ghostscript to render a PDF to a PNG