使用Ghostscript分割PDF [英] Splitting a PDF with Ghostscript

查看:149
本文介绍了使用Ghostscript分割PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用Ghostscript拆分多页PDF,并且在更多网站上甚至在 ghostscript上都找到了相同的解决方案.com ,即:

I try to split a multipage PDF with Ghostscript, and I found the same solution on more sites and even on ghostscript.com, namely:

gs -sDEVICE=pdfwrite -dSAFER -o outname.%d.pdf input.pdf

但是它似乎对我不起作用,因为它会生成一个文件, 所有页面,名称为 outname.1.pdf .

But it seems not working for me, because it produces one file, with all pages, and with the name outname.1.pdf.

当我添加起始页和结束页时,它可以正常工作,但是我 希望它在不知道这些参数的情况下工作.

When I add the start and end pages, then it is working fine, but I want it to work without knowing those parameters.

在gs-devel档案中,我找到了一个解决方案: http://ghostscript.com/pipermail/gs-devel/2009-April/008310.html - 但我想在没有pdf_info的情况下这样做.

In the gs-devel archive, I found a solution for this: http://ghostscript.com/pipermail/gs-devel/2009-April/008310.html -- but I feel like doing it without pdf_info.

当我使用其他设备时,例如pswrite,但相同 参数,它可以正常工作,生成与我一样多的ps文件 input.pdf 包含.

When I use a different device, for example pswrite, but same parameters, it works correctly, producing as many ps files, as my input.pdf contains.

使用pdfwrite正常吗?我在做错什么吗?

Is this normal when using pdfwrite? Am I doing something wrong?

推荐答案

您看到的是正常"行为:Ghostscript的pdfwrite输出设备的当前版本不支持此功能.这也(以某种方式含糊其词)记录在

What you see is "normal" behaviour: the current version of Ghostscript's pdfwrite output device does not support this feature. This is also (admittedly, somehow vaguely) documented in Use.htm:

请注意,但并非所有设备都支持每个文件一页的功能...."

"Note, however that the one page per file feature may not be supported by all devices...."

我似乎记得在IRC上提到的一位Ghostscript开发人员,他们可能会在将来的版本中 将此功能添加到pdfwrite中,但这似乎需要重写一些主要代码,这就是为什么他们还没做...

I seem to remember that one of the Ghostscript developers mentioned on IRC that they may add this feature to pdfwrite in some future release, but it seems to necessitate some major code rewrite, which is why they haven't done it yet...

更新:正如戈登的评论所暗示的那样,截至版本9.06 (于2012年7月31日发布),Ghostscript现在支持命令行,如问题中针对pdfwrite所述. (戈登一定已经在9.05中发现了对此的非正式支持,或者他从尚未标记为9.06的预发布源中编译了自己的可执行文件.)

Update: As Gordon's comment already hinted at, as of version 9.06 (released on July 31st, 2012), Ghostscript now supports the commandline as quoted in the question also for pdfwrite. (Gordon must have discovered the unofficial support for this already in 9.05, or he compiled his own executable from the pre-release sources which were not yet tagged as 9.06).

这篇关于使用Ghostscript分割PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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