Page 2 of 3
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T07:59:19-07:00
by michellux
yes quality is higher, the PNG is now 2356x3333
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T08:07:44-07:00
by michellux
Yes quality is higher. PNG file is now 2356x3333 dpi
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-04T08:35:35-07:00
by snibgo
Good. So now:
Code: Select all
convert myfile-*.png -page 2600x3333 r2.pdf
... should give you a right-margin.
If that works, try it in one step:
Code: Select all
convert -density 300 mypdf.pdf -resize 95% -page 2600x3333 mynewpdf.pdf
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T02:20:44-07:00
by michellux
Thanks a lot Snibgo ! It works perfectly and I understood the way to do. But, there is another point, which is the final weight of the document. So I tried different densities to find the best compromise between quality and weight. (original PDF is 2MB, resized pdf - density 300 dpi: 155 MB, 150 dpi: 40 MB, 100 dpi: 18 MB). I know ImageMacker is not Acrobat, but no way to lighten the document without loosing quality ?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T06:17:50-07:00
by pipitas
michellux wrote: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.
Just in case you are going this route to resize a PDF (via ImageMagick) as an "act of desperation" because...
- you are not aware of any other way to add an extra margin to the PDF pages (or to resize them),
- but you are not really interested (which you may nevertheless still be for some reason beyond my knowledge) to convert your PDF fonts/vectors to mince-meated (and either bad quality or big file size) full-page pixel graphics (it's just the price you pay for getting the resizing)...
...there are also ways to
preserve your PDF quality and still get the resize done.
Here is a method to get this done with Ghostscript:
1. First, create a demo PDF file with 2 pages (A4) 595 x 842 pt each, using Ghostscript:
Code: Select all
gs \
-o origin.pdf \
-sDEVICE=pdfwrite \
-g5950x8420 \
-c "1 0 0 setrgbcolor 0 0 595 842 rectfill \
1 setgray \
10 10 575 822 rectstroke \
/Helvetica findfont 36 scalefont setfont \
20 800 moveto \
(Page 1) show showpage
0 1 0 setrgbcolor \
0 0 595 842 rectfill \
1 setgray \
10 10 575 822 rectstroke \
20 800 moveto \
(Page 2) show showpage"
2. Second, place the demo PDF on pages with dimensions of 630 x 842 pt (you use your own PDF for this of course!), creating
temp-630x842pt.pdf
Code: Select all
gs \
-o temp-630x842pt.pdf \
-sDEVICE=pdfwrite \
-g6300x8420 \
origin.pdf
3. Last, place the intermediate PDF file on pages with dimensions of 595 x 842 pt again (this time using "scale to fit"), creating
rescaled.pdf:
Code: Select all
gs \
-o rescaled.pdf \
-sDEVICE=pdfwrite \
-g5950x8420 \
-dPDFFitPage \
-f temp-630x842pt.pdf
Voila -- your original PDF is rescaled, and you've avoided the mince-meating of all your vector and font elements into purely raster data! (Unless there is a valid reason why you
wanted this rasterization in the first place!). Here is a picture that shows the steps:
On the left is the original page. In the center is the original page, placed on a page that is 630 pts wide. On the right is the original page as it appears after the page from the center image is scaled back to A4.
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T07:32:44-07:00
by snibgo
michellux wrote:I know ImageMacker is not Acrobat, but no way to lighten the document without loosing quality ?
I expect the method shown by pipitas keeps the filesize small, while retaining all the quality. This is because it does not not convert vectors into pixels.
For processing PDF files, Ghostscript is a more natural tool than ImageMagick.
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T08:01:41-07:00
by michellux
@ Snigbo : ok I understand better now. Thanks for all you did.

@ Pipitas : Thanks. I still work on your solution. I cannot see the image you put in. I'll give my email in MP. Can you please send it to me ?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T12:20:48-07:00
by pipitas
michellux wrote:I cannot see the image you put in.
Anybody else who cannot see the image?!?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T13:25:31-07:00
by fmw42
I see all three of your images that have been concatenated into one image and the final images shows fine for me. It might be a browser issue?
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T13:29:35-07:00
by pipitas
fmw42 wrote:I see all three of your images that have been concatenated into one image
Yes, that's how it is supposed to be....
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-08T13:29:54-07:00
by snibgo
It shows fine for me. It can be downloaded from
http://i.stack.imgur.com/o5mVu.png
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-09T01:58:25-07:00
by michellux
It is McAfee Web Gateway (used by my company) which blocked the URL. I asked the hotline to send me the file

Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-09T02:56:03-07:00
by pipitas
Maybe we should ask the ImageMagick developers if they could start to create a new '-metric pr0n' measurement method.
It would return a number in the range of {0..100} telling the probability in percent of an image being NSFW. McAffee could then make use of it and let pass all images which are below a threshold of, say, 10%...

Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-09T23:40:46-07:00
by michellux
Sorry, but I really don't know Ghostscript. I downloaded and installed it, and Gsview too, but I really don't see how to do the 3 phases you describe ...
Re: How can I resize a PDF and keep a right blank margin
Posted: 2014-12-10T03:13:52-07:00
by michellux
Why should I do Phase 1 "Creating demo.pdf" if in phase 2 I use my pdf file ?