I have a set of images stored as separate PDF files. One image per file. Each image takes up one PDF page.

I need to re-scale all of these images, preferably at the command line, so that the image content and the page dimensions of the PDFs are both scaled relative to their original sizes/dimensions. For example: scale all the images by 50% should shrink the size of the image and the dimensions of the page.

Already tried:

  • pdfpages + latex: will re-scale the image but dimensions of the pages stay the same.
  • pdfjam: same problem; can re-scale but page dimensions want to be letterpaper or a4.
  • convert (imagemagick): converts to raster, which I don't want.
  • ghostscript: seems to scale based on absolute new page size, and I need relative page size.

I know one of these must work. I can't figure out where I've gone wrong. I'm on Mac but a Linux solution would work just as well.


I think I found one: http://community.coherentpdf.com/

cpdf -scale-page "0.5 0.5" in.pdf -o out.pdf

  • 3
    Yes thanks. I use cpdf -scale-to-fit "210mm 210mm" in.pdf -o out.pdf and it works great – maxbellec Feb 22 '17 at 10:25
  • 2
    could not find cpdf in ubuntu repos but for me pdfjam as per this answer did the trick. – cardamom Aug 28 '17 at 11:15
  • I used pdfposter as per this answer. – olivieradam666 Jun 12 '18 at 8:49
  • Thanks, this is a magical tool! – Autodidact Jul 20 '19 at 21:24
  • Where did you find documentation on this? I can't find this answer by searching for scaling pdf on linux command line. – young_souvlaki Jun 3 '20 at 2:24

pdfjam works for this.

pdfjam --outfile out.pdf --paper a5paper in.pdf
  • Yes, and you can also just add --landscape to do exactly that. – Markus Strauss Sep 24 '20 at 11:23
  • I wanted to really just scale both dimensions by some factor. In order to keep the initial image ratio you need to specify the explicit target size, e.g. --papersize '{16in,10in}' for some 16:10 ratio. Otherwise you might end up with unexpected whitespace around the image. You could extract the initial size as suggested here. – bixel Apr 9 at 10:38

I also had a problem finding a tool that can do something like that; I want to change page size of and rotate a PDF document, but without scaling contents. And I just realized pdfedit (which is a GUI tool, however), can do it:

  • After the document is opened, go to Page/"Edit page metrics", and then edit the x,y positions of left upper/right lower corners, and then Change.
  • After that, can go to Page/"Rotate page 90 Degrees"

Note that:

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.