Cropping a pdf file doesn't change it's size

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
handschigl
Posts: 1
Joined: 2011-08-02T14:31:33-07:00
Authentication code: 8675308

Cropping a pdf file doesn't change it's size

Post by handschigl »

Hello,

I cropped a pdf file. That's the code:

Code: Select all

# identify 17.pdf
17.pdf PDF 595x842 595x842+0+0 DirectClass 16-bit 1.43341mb
# convert 17.pdf -crop 200x200+0+0 tmp.pdf
# identify tmp.pdf
tmp.pdf PDF 595x842 595x842+0+0 DirectClass 16-bit 1.43341mb
Opening the new file tmp.pdf shows that it worked, but the size 595x842 has not been changed.
So it's not possible to create a correct jpeg thumbnail of the cropped pdf file.
There is always white space above the real content. I guess, this happens because of the wrong size of the new file...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cropping a pdf file doesn't change it's size

Post by fmw42 »

the size of a vector pdf file is mostly controlled by its density. you may have to convert it to a pixel format and then crop it and then convert back to pdf. However, IM is not the best tool for going back and forth. I have never used this and don't really know what it does, but perhaps see -define pdf:use-cropbox=true in the link below. Or perhaps by using -page to set the virtual canvas. See the links below.

see
http://www.imagemagick.org/Usage/formats/#vector
http://www.imagemagick.org/Usage/formats/#ps
http://www.imagemagick.org/Usage/text/#postscript
http://www.imagemagick.org/Usage/basics/#page
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Cropping a pdf file doesn't change it's size

Post by anthony »

Particularly the first link...

A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply