Page 1 of 1

jpg to pdf - with original size

Posted: 2012-05-26T04:33:54-07:00
by KingCanadian
Hello folks,

im trying to convert a jpg (scanned with 150 dpi) to a pdf with a4 papersize.
But the scan shoud appear in original size.

At first i tryed the following:

Code: Select all

convert test.jpg -page a4 out.pdf
But the image spans the complete width of the pdf.

Then i read the forum and googled:
the -density should help

So i tryed:

Code: Select all

convert test.jpg -page a4 -density 150 out.pdf
But nothing changes - the image is still not original size.
What am i doing wrong?

Regards
Juergen

Re: jpg to pdf - with original size

Posted: 2012-05-29T02:48:18-07:00
by indiego
I get the same results here. Also tried a two step conversion, but '-page a4' always blows up the graphic to canvas size.
You should give 'sam2p' a try, which is mentioned here [search for 'Image to PDF converters...']

http://www.imagemagick.org/Usage/formats/#vector

I guess 'sam2p_pdf_scale.pl' simply changes the size of the pdf boxes (no size increase, as with the bigger A4 canvas).

Untested (running out of time).

Re: jpg to pdf - with original size

Posted: 2012-05-31T04:03:18-07:00
by KingCanadian
Thank you for your reply,
but unfortunately sam2p too makes a pdf not with the original size and not in A4.

So i am still searching for a solution how can i get a jpg in original size to a A4pdf.

Re: jpg to pdf - with original size

Posted: 2012-05-31T09:49:03-07:00
by fmw42
try resizing (-resize) to the size specified by the A4 page size (595x842). see http://www.imagemagick.org/script/comma ... s.php#page

Re: jpg to pdf - with original size

Posted: 2012-05-31T21:05:49-07:00
by KingCanadian
Perhaps i should explain again:

My scanned jpg is in original 15x10cm - i want that to be shown and printed in the middle or top of a A4 PDF. The rest of the page should be white.

Re: jpg to pdf - with original size

Posted: 2012-06-02T02:18:53-07:00
by indiego
This works, but there are better ways to create such a PDF (e.g. ConTeXt).

Code: Select all

convert -density 150 -size 1239x1754 xc:white -density 150 test.jpg -gravity center -composite test.pdf
size: (210mm/25,4mm*150) x (297mm/25,4mm*150)

Re: jpg to pdf - with original size

Posted: 2012-08-12T09:50:55-07:00
by jobjol
Try this command.
ImageMagick doesn't work well alone, but in tandem with other apps it will do the trick.
Check the output and functionality of the command @ http://convertjpgpdf.net

Code: Select all

convert -scale ".$HEIGHT."x".$WIDTH." -border ".$MARGIN."x".$MARGIN." -bordercolor white $inputfile $outputfile

find . -maxdepth 1 -iname 'page*.jpg' -exec sam2p '{}' '{}'.pdf \;"
sam2p_pdf_scale ".$PAGE_WIDTH." ".$PAGE_HEIGHT." page".$key.".jpg.pdf
pdfjoin page*.pdf --outfile out.pdf