Howto convert A4 jpeg scanned page to A4 pdf

╄→гoц情女王★ 提交于 2020-12-04 08:56:51

问题


I have a jpeg scanned page (toto.jpg) that I want to convert to a A4 pdf file with imagemagick convert command.

I've been trying the -page A4, -resize 595x842 and -define pdf:fit-page=A4 options but it does not work, I don't obtain the correct size :

$ identify toto.jpg 
toto.jpg JPEG 1644x2304 1644x2304+0+0 8-bit DirectClass 902KB 0.000u 0:00.000
$ convert -density 300 -page a4 toto.jpg toto.pdf 
$ identify toto.pdf 
toto.pdf PDF 143x202 143x202+0+0 16-bit Bilevel DirectClass 3.7KB 0.000u 0:00.000
$ convert -density 300 -resize 595x842 toto.jpg toto.pdf 
$ identify toto.pdf 
toto.pdf PDF 143x200 143x200+0+0 16-bit Bilevel DirectClass 3.66KB 0.000u 0:00.000
$ convert -density 300 -define pdf:fit-page=A4 toto.jpg toto.pdf 
$ identify toto.pdf 
toto.pdf PDF 395x553 395x553+0+0 16-bit Bilevel DirectClass 27.7KB 0.000u 0:00.000

Can you help me ?


回答1:


After a few hours of trying, I've found the output resolution I was using was wrong.

To produce a pdf from a picture, one must change the output density to fit the screen's, that is to say 72dpi :

$ convert -density 72 -page A4 toto.jpg toto.pdf

this also works :

$ convert +density -page A4 toto.jpg toto.pdf

and the produced pdf is :

$ identify toto.pdf 
toto.pdf PDF 595x842 595x842+0+0 16-bit Bilevel DirectClass 63.2KB 0.000u 0:00.000


来源:https://stackoverflow.com/questions/55122943/howto-convert-a4-jpeg-scanned-page-to-a4-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!