使用单个命令将多页pdf转换为多个页面 [英] Converting a multi page pdf to multiple pages using a single command

查看:209
本文介绍了使用单个命令将多页pdf转换为多个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有效地将​​多页pdf转换为单页图像。

I want to convert multi page pdfs into single page images efficiently.

我已经知道如何使用imagemagick一次完成这一页。例如,

I already know how to do this one page at a time with imagemagick. For example,

convert x.pdf[2] x3.jpg

会给我PDF格式的第3页作为图像。因此,如果我使用识别计算pdf中有多少页面,那么我可以循环并将pdf中的所有页面转换为图像。然而,这种方法可能需要一段时间。例如,15页pdf可能需要15-30秒。

will give me the 3rd page of the pdf as an image. So if I figure out how many pages are in the pdf using identify then I can loop through and convert all pages in the pdf to images. This method can however take a while. For example a 15 page pdf could take anywhere between 15-30 seconds.

根据我在其他地方(也在imagemagick论坛上)看到的答案,以下imagemagick命令应该将pdf分成多个图像。

According to answers that I have seen elsewhere (also on the imagemagick forums) the following imagemagick command should split a pdf into multiple images.

convert x.pdf x-%0d.jpg

但所有这一切最终都是创建名为 x-0.jpg

but all this ends up doing is creating the first page named x-0.jpg

作为替代方案,我尝试使用具有突发功能的pdftk。我在那里遇到的问题是爆炸在所有情况下都不起作用。它适用于某些pdf,而不适用于其他一些。

As an alternative I have tried using pdftk with the burst capability. The problem I faced there is that burst does not work in all cases. It does for some pdf's and does not for some others.

任何关于如何改进的建议都会有所帮助。

Any suggestions on how to improve things would help.

我的操作系统是Mac OSX Lion,但我也需要在CentOS 6上工作。

My OS is Mac OSX Lion but I do need this working on CentOS 6 as well.

推荐答案

你错过了数字量。使用:

You're missing the quantity of digits. Use:

convert x.pdf x-%04d.jpg

其中 4 表示页数会显示4位数。

Where 4 means 4 digits will be show on the page count.

这篇关于使用单个命令将多页pdf转换为多个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆