Page 1 of 1

Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T01:26:41-07:00
by Laxgi
Hey,

I would like to scale big PDFs to A4-papersize. Tried different Tools, but all of them delete graphical annotations (you can add them via Adobe - Reader).
So I found the beautiful tool "convert"

PDF to PDF A4 doens't work for me, any fault in this command?

Code: Select all

convert -density 300 win/tmp/A3.PDF -page A4 win/tmp/A4.pdf
Also I've tried convertig PDF to JPG with -scale:

Code: Select all

convert -density 300 -scale 4460x3460 -frame 50x50 -mattecolor white win/tmp/THY.pdf win/tmp/XY.jpg
and then:

Code: Select all

convert -density 300 win/tmp/XY.jpg -scale 4510x3510 -quality 92 win/tmp/XY.pdf
That works, but when I print the PDF with an laser-printer, the Quality is too "corny". The Printer is not the Problem.
Image

PDF to PDF would be the better way...

Thanks for any tricks.

Greetings from Germany
Laxgi

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T02:05:24-07:00
by snibgo
Sorry, I know nothing about "-page". I would simply resize. The ratio between A-sizes is 1/sqrt(2) = 70.71%.

Code: Select all

convert -density 300 in.pdf -resize 70.71% out.pdf[code]

Note the resize must come after the input has been read.

For best quality you might need different density, eg 600.

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T02:21:51-07:00
by Laxgi
Resize works perfect, size is correct but the Quality is bad.

Code: Select all

convert win/tmp/THY.pdf -resize 70.71%  win/tmp/THTEST.PDF
When I use

Code: Select all

convert -density 300 win/tmp/THY.pdf -resize 70.71%  win/tmp/THTEST.PDF
Size is "50,4 x 71,3 mm".

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T02:47:36-07:00
by snibgo
What is the DPI of the scan? For best results, use the same density.

If that doesn't help, can you put the input pdf somewhere like dropbox.com and paste the link here?

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T03:17:02-07:00
by dlemstra
You should specify -page A4 before loading the PDF.

Code: Select all

convert -density 300 -page A4 win/tmp/A3.PDF win/tmp/A4.pdf
Can you add a link to your PDF so we can use it for testing?

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T03:51:14-07:00
by Laxgi
No Problem, I made a simple Test-PDF with graphical Annotations (they are very important for me):

http://huebner-tim.de/wordpress/?attachment_id=501
With this

Code: Select all

convert -density 300 -page A4 win/tmp/A3.PDF win/tmp/A4.pdf
I get this result (only cutted, not smaller):

Image

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T04:16:24-07:00
by snibgo
With ...

Code: Select all

convert -density 600 -page a4 testa3.pdf  a.pdf
... the page size (in inches) is very small, and it is truncated on the right.

With ...

Code: Select all

convert -density 600 testa3.pdf -resize 70.71% a.pdf
... the result seems to be fine.

IM v6.8.8-7 on Windows 8.1, Ghostscript 9.10.

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T04:34:07-07:00
by Laxgi
With

Code: Select all

convert -density 600 testa3.pdf -resize 70.71% a.pdf
I get:
"Page size: 25,0 x 35,6mm"
That's not the correct page size. :(

Image

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T04:46:10-07:00
by snibgo
I get a page size of 8.27x11.69 inches, according to Adobe Reader.

What version of IM and GS are you using?

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T04:49:37-07:00
by Laxgi
Im using GS 8.7 and IM 6.28.

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-21T04:57:42-07:00
by snibgo
Ancient versions of both. I suggest you upgrade.

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-23T23:51:26-07:00
by Laxgi
Updating is not possible,

but I found an Solution for me:

Converting to PDF incl. resizing

Code: Select all

convert -density 500 win/tmp/1in.pdf -resize 70.71% win/tmp/6.jpg
Converting to PDF

Code: Select all

convert win/tmp/6.jpg win/tmp/6out.pdf

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-24T02:40:51-07:00
by Laxgi
Is it possible to make this a Little bit faster?
Maybe by compressing the pages or something else?
For 3 Pages in A3 in 300 DPI I need about 15 sec.

Code: Select all

convert -density 500 win/tmp/1in.pdf -resize 70.71% win/tmp/6.jpg
convert win/tmp/6.jpg win/tmp/6out.pdf

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-24T03:41:46-07:00
by dlemstra
The reason this is not that fast is because of the specified density. Try to lower it to a value that works for you.

And please try to see if you can upgrade your version of Ghostscript and ImageMagick. We have added a new feature that will make the conversion easier and probably faster for you. The new pdf:fit-page option will scale your pdf to the specified size while reading it.

Code: Select all

convert -density 300 -define pdf:fit-page=A4 win/tmp/1in.pdf win/tmp/6out.pdf

Re: Scale PDF to A4 (via PDF to JPG to PDF?)

Posted: 2014-02-24T08:21:15-07:00
by Laxgi
I'll try to update. density lower than 300 isn't possible, then you can't read smaller parts after printing.