PPTX DOCX XLSX PDF ODP
Aspose.PDF  Product Family
PDF

PDF 文档合并解决方案

使用免费的跨平台应用程序和API将多个PDF文件组合为单独的文档。使用.NET、.NET Core、Java、C++ 和安卓来合并 PDF 文件的本机 API

如何使用 Aspose.PDF 库合并 PDF 文件

为了合并 PDF 文件,我们将使用 Aspose.PDF API,这是一款功能丰富、功能强大且易于使用的文档处理 API。打开 NuGet 软件包管理器,搜索 Aspose.PDF 然后安装。您也可以在软件包管理器控制台中使用以下命令。

用于合并文档数据的高编码 API

使用.NET、.NET Core、Java、C++ 和安卓来合并 PDF 文件的本机 API。 合并一个或多个 PDF 文档是一项非常受欢迎的任务。Aspose.PDF 库在使用它方面做得非常出色。该示例是用 C# 编写的,但该 API 可以在其他 .NET 编程语言(如 VB.NET)中使用。合并PDF文件的方式是将第一个文件合并到另一个文档的末尾。Aspose.PDF 显示了组合各种格式的文件。点击链接,熟悉将文件与 Aspose.PDF 库合并的所有可能性。

可能要合并PDF文件的原因有很多。例如,合并 PDF 文件允许您打印单个文件,而不必将多个文档排队打印,而合并相关文件可减少需要搜索和整理的文件数量,从而简化了管理和存储许多文档的过程。

尝试通过 C# 合并 PDF 文件

通过 C# 将 PDF 与适用于 .NET 库的 Aspose.PDF 结合起来。

 

合并 PDF 文件的示例代码,C#。

    // Open first document
    Document pdfDocument1 = new Document(_dataDir + "Concat1.pdf");
    // Open second document
    Document pdfDocument2 = new Document(_dataDir + "Concat2.pdf");

    // Add pages of second document to the first
    document1.Pages.Add(document2.Pages);
    document.Save(_dataDir+"ConcatenatedPDF.pdf");
 

尝试通过 Java 合并 PDF 文件

通过 Java 将 PDF 与适用于 Java 库的 Aspose.PDF 结合起来。

 

合并PDF文件的示例代码,Java。

// Create PdfFileEditor object
PdfFileEditor fileEditor = new PdfFileEditor();
String[] files = new String[] { "file1.pdf", "file2.pdf", "pdf3.pdf" };
// Merge multiple PDF files
fileEditor.concatenate(files, "merged-pdf.pdf");
 

尝试通过 C++ 合并 PDF 文件

通过 C++ 将 PDF 与适用于 C++ 库的 Aspose.PDF 结合起来。

 

合并 PDF 文件的示例代码 C++。

// Open first document
auto doc1 = MakeObject<Document>(u"file1.pdf");

// Open second document
auto doc2 = MakeObject<Document>(u"file2.pdf");

// Add pages of second document to the first
doc1->get_Pages()->Add(doc2->get_Pages());

// Save concatenated output file
doc1->Save(u"merged-output.pdf");
 

尝试通过 Python 合并 PDF 文件

通过 Python 将 PDF 与 Python 库中的 Aspose.PDF for .NET 结合起来。

 

合并 PDF 文件的示例代码,Python。

    // Open first document
    Document merge_file1 = new Document("PDF1.pdf");
    // Open second document
    Document merge_file2 = new Document("PDF2.pdf");
    // Add pages of second document to the first
    merge_file1.Pages.Add(merge_file2.Pages);
    // Save concatenated output file
    merge_file1.Save("mergedPDF.pdf");
 

PDF 在线合并