I have a pdf with different size pages. The first page is 579.275 by 402.547 points. The remaining pages are 612 by 792 pts (letter). I would like to have all the pages be letter size. The output from pdfinfo -box -f 1 -l 10 A.pdf is:

$ pdfinfo -box -f 1 -l 10 A.pdf 
Creator:        Toolkit http://www.activepdf.com
Producer:       Toolkit http://www.activepdf.com
CreationDate:   Sat Feb  4 18:42:49 2012
ModDate:        Sat Feb  4 18:42:49 2012
Tagged:         no
Form:           AcroForm
Pages:          5
Encrypted:      no
Page    1 size: 579.275 x 402.547 pts
Page    1 rot:  0
Page    2 size: 612 x 792 pts (letter)
Page    2 rot:  0
Page    3 size: 612 x 792 pts (letter)
Page    3 rot:  0
Page    4 size: 612 x 792 pts (letter)
Page    4 rot:  0
Page    5 size: 612 x 792 pts (letter)
Page    5 rot:  0
Page    1 MediaBox:     0.00     0.00   612.00   792.00
Page    1 CropBox:     15.05   374.40   594.33   776.94
Page    1 BleedBox:    15.05   374.40   594.33   776.94
Page    1 TrimBox:     15.05   374.40   594.33   776.94
Page    1 ArtBox:      15.05   374.40   594.33   776.94
Page    2 MediaBox:     0.00     0.00   612.00   792.00
Page    2 CropBox:      0.00     0.00   612.00   792.00
Page    2 BleedBox:     0.00     0.00   612.00   792.00
Page    2 TrimBox:      0.00     0.00   612.00   792.00
Page    2 ArtBox:       0.00     0.00   612.00   792.00
File size:      211688 bytes
Optimized:      no
PDF version:    1.3

I've attempted many variations of a ghostscript command with flags -sPAPERSIZE, -dFIXEDMEDIA, -dPDFFitPage. I cannot figure out how to get the first page to be letter. I do not care if the content of the first page is scaled up.

Question: How can I make all the pages the same size?

The reason for this question is that we have a new printer in the office. For reasons that I don't fully understand newer versions of CUPS or ghostscript cause the print server to crash. We have the ability to print from a USB storage device, but the printer will not accept documents with page sizes other than letter.


The output of your pdfinfo command clearly shows that all your pages have the same size: 612 x 792 pt ("MediaBox"), which is the 'letter' size.

However, page 1 is set to tell the PDF viewer (and the printer) to display only a part the page area ("CropBox").

If you remove the CropBox (as well as the Art-, Bleed- and TrimBox-es) settings in your PDF with a tool of your choice (even a text editor), or if you change them to the same values as the MediaBox, you'll have PDF viewers (and printers) show the full page content (even if the "rest" is only white margins). Note: it may happen that there is hidden content on your first page which becomes visible if you remove the Crop-, Trim-, Bleed- and ArtBoxes.

|improve this answer|||||
  • Thanks for pointing this out! I was able to change the cropbox setting by editing the pdf directly. However, I can't figure out how to do it with ghostscript. Can you recommend a command or another tool? – nwhsvc Jun 11 '12 at 21:54

You can e.g. use Pdftk to split the document into the front page and the correctly sized portion, then resize the front page with e.g. GhostScript as you have already tried and finally merge the document again with Pdftk. This could be scripted if it is a common operation that needs to be done.

Also see https://stackoverflow.com/questions/547326/using-imagemagick-or-ghostscript-or-something-to-scale-pdf-to-fit-page for more hints.

|improve this answer|||||
  • This did not work on the original PDF! However, I was able to scale another single-page PDF successfully with both -dFIXEDMEDIA and -dPDFFitPage. Is there a reason that ghostscript would not scale a particular PDF? Also, pdftk produced a pdf that caused ghostscript to give the following warning "Warning: considering '0000000000 XXXXX n' as a free entry". – nwhsvc Jun 9 '12 at 0:01

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.