我想自动将一个大的PDF文档拆分为两个文件:一个文件应仅包含黑白内容的页面,另一个文件应仅包含任何彩色内容的页面。彩色页面和黑白页面并不连续——它们散布在整个文档中。我怎样才能自动执行此操作?
答案1
克里斯·罗杰斯编写了一个 Perl 脚本将 PDF 文件分割为彩色和黑白页面。这是脚本的链接:pdfcolor-1.2.tgz。
网站上对该脚本如何工作的详细说明:
- Perl script
- uses:
– “pscolor” (C, “using GS DLL as a ps colorpage separator”) by Carsten Hammer
– “joinPDF” (Java, “Command line tool to join and split PDF files”, for mac) by Gerard Briscoe
- Has hardcoded paths in shell scripts “splitPDF” and “joinPDF”
- Depends on flex
- Depends on libgs-dev
- GNU GPL 2.0
How it works:
split PDF into single pages in temporary location
use pscolor to detect whether color is on the page
reassemble pages with color and pages without color into two pdf files.
Does not work when adjusting said hardcoded paths.