简体   繁体   English

如何使用 Perl 合并 PDF 文件?

[英]How can I merge PDF files with Perl?

使用 Perl,我如何将示例 PDF 文件合并或合并为单个 PDF 文件?

CAM::PDF can do this quite easily, and has a simple command-line front end to help. CAM::PDF可以很容易地做到这一点,并有一个简单的命令行前端来提供帮助。 Note: I'm the author of that library.注意:我是那个库的作者。 Example:例子:

appendpdf.pl file1.pdf file2.pdf outfile.pdf

From the SYNOPSIS section of the perldoc :perldoc的概要部分:

my $anotherpdf = CAM::PDF->new('test2.pdf');
$pdf->appendPDF($anotherpdf);

Why do you need to do it from Perl?为什么你需要从 Perl 做它? Chris has already mentioned CAM::PDF . Chris 已经提到了CAM::PDF

If you just need to merge them, pdftk (PDF ToolKit) works just fine.如果您只需要合并它们, pdftk (PDF ToolKit)工作得很好。 It's a simple command line:这是一个简单的命令行:

pdftk file1.pdf file2.pdf cat output merged.pdf

您可以使用GhostScript实用程序pdf2ps将 PDF 转换为 PostScript 文件,连接 PostScript 文件,然后使用ps2pdf将结果转换回 PDF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM