如何将A4 jpeg扫描的页面转换为A4 pdf

时间:2019-03-12 13:42:30

标签: pdf imagemagick-convert

我有一个jpeg扫描页(toto.jpg),我想使用imagemagick convert命令转换为A4 pdf文件。

我一直在尝试-page A4-resize 595x842-define pdf:fit-page=A4选项,但是它不起作用,我没有获得正确的大小:

$ 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

你能帮我吗?

1 个答案:

答案 0 :(得分:0)

经过几个小时的尝试,我发现我使用的输出分辨率不正确。

要从图片生成pdf,必须更改输出密度以适合屏幕尺寸,即72dpi:

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

这也有效:

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

生成的pdf为:

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