How can I resize a PDF and keep a right blank margin
How can I resize a PDF and keep a right blank margin
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.
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
You can set the page size for the PDF. For example, if the input is 200x300 pixels:
This creates a 100 pixel margin on the right.
Code: Select all
convert r.jpg -page 300x300 r2.pdf
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
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...
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...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
This gives me two pages, each with a margin at top and right:
This is with IM v6.9.0-9, on Windows 8.1. What version IM are you using?
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
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
Well, I understand now ... I have IM v1 !!!
I will download a "fresh" version and tra again ...

-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
v1! Gosh. Take it to a museum.
Get a current Windows binary download from http://www.imagemagick.org/script/binar ... hp#windows
Get a current Windows binary download from http://www.imagemagick.org/script/binar ... hp#windows
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
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 ?
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 ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
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.
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:
For XXX and YYY, use some other numbers (because each page from the PDF will be bigger).
Yes, this can be done without intermediate files.
Code: Select all
convert mypdf.pdf -resize 95% -page 595x842 mynewpdf.pdf
Code: Select all
convert -density 300 mypdf.pdf -resize 95% -page XXXxYYY mynewpdf.pdf
snibgo's IM pages: im.snibgo.com
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
Ignore that. The version number comes from:michellux wrote:In fact, I confused with IM display version which is always 1.
Code: Select all
convert -version
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
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 ...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
Keep it simple. Change one thing at a time. Don't combine steps until each one works.
(Note: I use PNG, not JPG.)
What size is each PNG?
Then decide on suitable values for "-page".
Code: Select all
convert mypdf.pdf -resize 95% myfile.png
What size is each PNG?
Code: Select all
identify myfile-0.png
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
I have 8 files PNG 565x800 565x800+0+0 16-bit sRGB size between 0.78 to 1.438 MB
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
Now add "-density".
What size is each PNG?
Code: Select all
convert -density 300 mypdf.pdf -resize 95% myfile.png
Code: Select all
identify myfile-0.png
snibgo's IM pages: im.snibgo.com
Re: How can I resize a PDF and keep a right blank margin
size is now between 5.9 and 14.1 MB
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I resize a PDF and keep a right blank margin
MB don't matter. How many pixels? Is the quality better?
snibgo's IM pages: im.snibgo.com