I have an application that generates pdf files using ghostscript (current gs version 9.04). The pdf files it generates are placed up and to the left about 1/4 inch each, outside of the printable page. I can't change the application.

The intent is that these pdf files will generally be sent to a printer, and when I do try to print them I lose about 1/4 inch from the left and top as the whole document is shifted in that direction. The entire document is visible when viewed onscreen in acrobat reader, however the left and top margins seen on screen are minimal, while the right edge and bottom edge appear to each have roughly 1/2 inch margin.

I can work around this by telling Acrobat Reader to scale the document to fit the page when I print, but that adds a step for others who will be using the system, shrinks the text, and makes the document look off-center. Is there anything I can set in ghostscript to correct this at that level, to make the document render correctly in the first place?

  • Is this print distributor? Dec 13 '11 at 21:37
  • @kyle Updated the question. See the 2nd paragraph for clarification Dec 13 '11 at 21:44
  • @JoelCoehoorn: Would you please provide some additional details about your pages {Media,Crop,Trim}Box settings? (See also my start-of-an-answer below.) Jan 2 '12 at 10:30

Before I write up a more elaborate answer, you should provide a few more details about one of your sample PDF files. Use one with at least 3 pages. Then run this command:

 pdfinfo -f 1 -l 3 -box /path/to/pdf.pdf

This command will enumerate the page sizes ('MediaBox') as well as the dimensions for the viewable/printable parts ('CropBox') of each PDF page.

pdfinfo is part of the XPDF commandline utilities, available for free, for all major OS platforms (certainly for Windows and Linux).


Since you have Ghostscript already, you can also try this command:

gswin32c.exe ^
  -q ^
  -sFile=c:/path/to/your.pdf ^
  -dDumpMediaSizes ^

(On Linux, use gs instead of gswin32c.exe, and adapt the paths as needed.) Should your installation miss the pdf_info.ps file, try to download it from http://git.ghostscript.com/?p=ghostpdl.git;a=tree;f=gs/toolbin;hb=HEAD

  • +1 for last sentence, pdf_info.ps (and all of toolbin) is missing from Windows gs9.02. Dec 19 '12 at 18:53

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.