Page 1 of 1
Pdf image crop on windows server
Posted: 2016-09-06T03:03:14-07:00
by pieter
Hello,
Is it possible with imageMagick to crop a pdf to another pdf (with different size) with a command on windows server?
Kind regards,
Pieter
Re: Pdf image crop on windows server
Posted: 2016-09-06T03:41:53-07:00
by snibgo
Yes.
If you want more detail, we need more information. Do you want half the pages, or half of each page, or what? If your input pdf contains vector data or ordinary text, that will be rasterized (converted to pixels).
Re: Pdf image crop on windows server
Posted: 2016-09-09T03:43:01-07:00
by pieter
Hello snibgo, that sounds great. Thank you:)
Each pdf is one page with a photo on it, but it has a edge which is white. This white edge is for example 50 millimetre wide.
image hosting site over 5mb
It would great if a pdf can be cropped this way automaticly when a pdf is uploaded to a windows server. Another way is that a pdf can be send from our application to imagemagick with a command to crop the pdf. If one of these ways is possible this could save a lot of time for us:)
Re: Pdf image crop on windows server
Posted: 2016-09-09T03:53:25-07:00
by snibgo
pieter wrote:Each pdf is one page with a photo on it, ...
Okay. I would extract the photo with pdfimages, a tool available for Unix and Windows. This makes a raster image file, eg "myphoto.jpg". Then use IM to convert that to a PDF:
The result myphoto.pdf will have no margins.
Personally, I can't see the point of a PDF wrapper around raster images, but some people like them.
Re: Pdf image crop on windows server
Posted: 2016-09-09T05:43:53-07:00
by pieter
I am not sure whether we need pdfimages, because the pdf is actually one picture, (Not a pdf with a picture/photo/jpg in it).
Re: Pdf image crop on windows server
Posted: 2016-09-14T23:32:34-07:00
by pieter
Hello,
An update:
I have installed Image Magick and ghostscript.
I almost got a solution. I removed a white edge of 5 mm at the bottom, but unfortunatly a small white edge appeared at the top of the pdf. It is still a big improvement. I will work further on it.
Some examples:
magick -density 300 -quality 100 input.pdf -gravity South -chop 0X78 output.pdf
magick -density 400 -quality 100 input.pdf -gravity South -chop 0X70 output.pdf
magick -density 300x300 input.pdf -background white -extent 637.794x1003.9371 output.pdf
magick -density 254x254 input.pdf -gravity South -chop 0x59,05512 output.pdf
snibgo, again thanks for your suggestions:D
Pieter