Page 1 of 3
How can I resize a PDF and keep a right blank margin
Posted: 2014-12-03T23:52:54-07:00
by michellux
Hello,
Hope you can help me on my problem. I am working under Windows 7.
I have a .pdf file to resize, for example 95%, and convert it in .jpg. That is working fine. But if I take my .jpg to transform it back in .pdf, the image is automaticaly resized to take all the width of the document.
What I want after resizing is to keep a right blank vertical "margin" in the final .pdf document, and naturally, this should be done automatically, as I have many documents to treat.
Is it possible and how ?
Thanks for your help.
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T00:23:11-07:00
by snibgo
You can set the page size for the PDF. For example, if the input is 200x300 pixels:
Code: Select all
convert r.jpg -page 300x300 r2.pdf
This creates a 100 pixel margin on the right.
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T03:20:57-07:00
by michellux
Sorry, but I should have done something wrong as I did not get the result I expect.
Here are the commands I entered :
CONVERT MYPDF.PDF -RESIZE 95% MYPDF.JPG
This gave me one .jpg file for each page of my .pdf file. The dimensions of each page are : 565x800 dpi. Then I converted back in .pdf :
CONVERT MYPDF*.JPG -PAGE 595X842 MYNEWPDF.PDF
595x842 is the normal size for a A4 format page, and is bigger than the previous 565x800 dimensions for the .jpg, but I do not have any margin on my new document...
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T04:06:09-07:00
by snibgo
This gives me two pages, each with a margin at top and right:
Code: Select all
%IM%convert -size 565x800 gradient:red-blue r1.jpg
%IM%convert -size 565x800 gradient:red-lime r2.jpg
%IM%convert r1.jpg r2.jpg -page 595x842 r2.pdf
This is with IM v6.9.0-9, on Windows 8.1. What version IM are you using?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T04:20:42-07:00
by michellux
Well, I understand now ... I have IM v1 !!!

I will download a "fresh" version and tra again ...
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T04:55:04-07:00
by snibgo
v1! Gosh. Take it to a museum.
Get a current Windows binary download from
http://www.imagemagick.org/script/binar ... hp#windows
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T05:49:44-07:00
by michellux
In fact, I confused with IM display version which is always 1. Nevertheless, I started a complete new install, and now it works perfectly. Thanks.
But now, the quality of the new .pdf file is very poor comparing with the original .pdf. Is there any solution to keep the original quality of the document ? I tried with doubling the DPI resolution, but it is still insufficient.
And another question, if I can permit, is it possible to do all the process in one phase, without using any .jpeg files ?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T06:06:21-07:00
by snibgo
For best quality, do
not use jpeg for intermediate files. In fact, never use jpeg at all.
Yes, this can be done without intermediate files.
Code: Select all
convert mypdf.pdf -resize 95% -page 595x842 mynewpdf.pdf
ImageMagic is a raster image processor. Raster images are made of pixels. PDF files can contain raster images or vectors (like text) or both. The "-density" setting is normally required, eg:
Code: Select all
convert -density 300 mypdf.pdf -resize 95% -page XXXxYYY mynewpdf.pdf
For XXX and YYY, use some other numbers (because each page from the PDF will be bigger).
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T06:08:45-07:00
by snibgo
michellux wrote:In fact, I confused with IM display version which is always 1.
Ignore that. The version number comes from:
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T06:32:57-07:00
by michellux
If I try CONVERT in one step with -density parameter, I lost my right margin (?!). If do it without -density parameter, I keep my margin, but not the quality ...
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T06:50:53-07:00
by snibgo
Keep it simple. Change one thing at a time. Don't combine steps until each one works.
Code: Select all
convert mypdf.pdf -resize 95% myfile.png
(Note: I use PNG, not JPG.)
What size is each PNG?
Then decide on suitable values for "-page".
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T07:25:34-07:00
by michellux
I have 8 files PNG 565x800 565x800+0+0 16-bit sRGB size between 0.78 to 1.438 MB
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T07:32:09-07:00
by snibgo
Now add "-density".
Code: Select all
convert -density 300 mypdf.pdf -resize 95% myfile.png
What size is each PNG?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T07:41:32-07:00
by michellux
size is now between 5.9 and 14.1 MB
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T07:54:51-07:00
by snibgo
MB don't matter. How many pixels? Is the quality better?