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

问题描述 投票:0回答:1

我有一个jpeg扫描页面(toto.jpg),我想用imagemagick转换命令转换为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

你能帮助我吗 ?

pdf imagemagick-convert
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.