Page 1 of 1

Resizing a PDF with landscape pages creates errors

Posted: 2009-11-29T05:36:35-07:00
by virtual
Hi all,

I'm not sure if I'm going about this in the right way, I'll explain my needs:

1. I need all the output images in a common format (standard A4 size)
2. Any sized PDF should be created using the above format.
3. I don't know, when using ImageMagick, whether the PDF will contain landscaped or other strange format pages.

The code I am using is:

Code: Select all

exec("convert input.pdf -resize 475x670! -strip -quality 90 output.jpg");
Now, when I convert portrait PDF's into this format it works great. However, one can also use landscape PDF's, or other strange shapes: Here's what it looks like:

- http://i50.tinypic.com/35n80me.jpg

Am I doing something wrong, or is there another way I should be doing this?

Thanks all, I'm kind of stuck with this one!

Edit: Oops, here is an example of the PDF I'm using to test: http://jump.fm/OBURI

Re: Resizing a PDF with landscape pages creates errors

Posted: 2009-11-29T18:16:11-07:00
by anthony
You could use -resize 670x670 which will fit the image into a box of that size. That is only the longest dimension becomes 670 pixel long. The other dimension is adjusted to best preserve the images aspect ratio.

The other method is ensure the image is portrait but doing a conditional rotate -rotate -90\> before the resize.