Skip to content Skip to sidebar Skip to footer

Need To Programmatically Convert PDF Paper Size (e.g. US-Letter To A4) In Python (or Command Line)

I need to convert PDF documents from one arbitrary page size to another. For example, I might have a bunch of PDF documents formatted for us-letter paper (8.5' x 11') that I need t

Solution 1:

You could use

  • Ghostscript using the -sPAPERSIZE=a4 switch, see chapter 3.3 the docs or a full solution here on SO, or
  • pdfjam(a shell script that is part of texlive), with the --paper a4paper option, as described of unix.SE

Solution 2:

In ubuntu, I would use "convert" from the command line.

This line is working for me to convert from Letter to A4 :

convert -page A4 a.pdf a2.pdf

See the -page parameter on the imagemagick website for more details:

http://www.imagemagick.org/script/command-line-options.php#page


Post a Comment for "Need To Programmatically Convert PDF Paper Size (e.g. US-Letter To A4) In Python (or Command Line)"