How do I control PDF paper size with ImageMagick? How do I control PDF paper size with ImageMagick? linux linux

How do I control PDF paper size with ImageMagick?


This question is pretty old, but I had a similar problem and I think I found the solution.

The documentation for the -page option says "This option is used in concert with -density", but the relationship between the options seems a little unclear, possibly because the documentation is geared towards raster images.

From experimenting with the settings, I found that the pdf page size can be controlled by combining -page -density and -units. The documentation for -page shows that letter is the same as entering 612 x 792. Combining -density 72 with -units pixelsperinch will give you (612px /72px) * 1in = 8.5in.

convert *.jpg -units pixelsperinch -density 72 -page letter foo.pdf should do what the original poster wanted.


I just succeeded withconvert file.mng -page letter file.pdf


For Letter, you need to specify the size as 792x612 PostScript points. Therefor try this command:

 convert \    in1.jpg \    in2.jpg \    in3.jpg \    in4.jpg \    in5.jpg \   -gravity center \   -resize 792x612\! \    letter.pdf

Works for me with ImageMagick version 6.7.8-3 2012-07-19 Q16 on Mac OS X:

identify -format "%f[%s] :  %W x %H\n" letter.pdf  letter.pdf[0] :  792 x 612  letter.pdf[1] :  792 x 612  letter.pdf[2] :  792 x 612  letter.pdf[3] :  792 x 612  letter.pdf[4] :  792 x 612

Or

pdfinfo -f 1 -l 5 letter.pdf   Title:          _  Producer:       ImageMagick 6.7.8-3 2012-07-19 Q16 http://www.imagemagick.org  CreationDate:   Fri Jul 27 22:28:00 2012  ModDate:        Fri Jul 27 22:28:00 2012  Tagged:         no  Form:           none  Pages:          5  Encrypted:      no  Page    1 size: 792 x 612 pts (letter)  Page    1 rot:  0  Page    2 size: 792 x 612 pts (letter)  Page    2 rot:  0  Page    3 size: 792 x 612 pts (letter)  Page    3 rot:  0  Page    4 size: 792 x 612 pts (letter)  Page    4 rot:  0  Page    5 size: 792 x 612 pts (letter)  Page    5 rot:  0  File size:      178642 bytes  Optimized:      no  PDF version:    1.3