PPTX DOCX XLSX PDF ODP
Aspose.PDF  Product Family
PDF

文件合併解決方案

將多個 PDF 檔合併為單獨的文件,並提供免費的跨平臺應用程式和 API。本機 API,用於使用 .NET、.NET Core、Java C++和安卓功能組合 PDF 檔

如何使用「.PDF庫」合併 PDF 檔

為了合併PDF文件,我們將使用[Aspose.PDF](https://products.aspose.com/pdf)API,這是一個功能豐富,功能強大且易於使用的文檔操作API。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“aspose.PDF然後安裝。您也可以從程式包管理器主控台使用以下命令。

用於合併文檔數據的高代碼 API

本機 API,用於使用 .NET、.NET Core、Java C++和安卓系統來組合 PDF 檔。 合併一個或多個 PDF 文件是一項非常受歡迎的任務。阿波斯.PDF圖書館在這方面做得很好。該示例是用 C# 編寫的,但 API 可用於其他 .NET 程式設計語言,如 VB.NET。PDF 檔的合併方式使第一個檔在另一個文件的末尾連接。aspose.PDF顯示各種格式的組合檔。點擊連結,熟悉將檔與Aspose.PDF庫相結合的所有可能性。

您可能希望合併 PDF 檔的原因有很多。例如,合併 PDF 檔允許您列印單個檔,而不是將多個文檔排隊進行列印,而合併相關文件通過減少需要搜索和組織的檔數來簡化管理和存儲許多文檔的過程。

嘗試通過 C 語言合併 PDF 檔#

將通過 C# 的 [PDF](https://products.aspose.com/pdf/net/merger/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](https://products.aspose.com/pdf/java/merger/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](https://products.aspose.com/pdf/cpp/merger/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");
 

嘗試通過蟒蛇合併PDF檔

通過蟒蛇將 [PDF](https://products.aspose.com/pdf/python 網/合併/pdf/) 與阿波斯.PDF用於蟒蛇庫中的 .NET。

 

合併 PDF 檔的範例代碼,蟒蛇。

    // 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");
 

在線合併