Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
在 C# 中合并 PDF 不是一项简单的任务,除非使用第三方库。 本文展示了如何使用 Aspose.PDF for .NET 将多个 PDF 文件合并为一个单一的 PDF 文档。示例使用 C# 编写,但该 API 也可以在其他 .NET 编程语言中使用,例如 VB.NET。PDF 文件的合并方式是将第一个文件连接到其他文档的末尾。
以下代码片段也适用于 Aspose.PDF.Drawing 库。
要连接两个 PDF 文件:
以下代码片段展示了如何连接 PDF 文件。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void MergeDocuments()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Pages();
// Open PDF documents
using (var document1 = new Aspose.Pdf.Document(dataDir + "Concat1.pdf"))
{
using (var document2 = new Aspose.Pdf.Document(dataDir + "Concat2.pdf"))
{
// Add pages of second document to the first
document1.Pages.Add(document2.Pages);
// Save PDF document
document1.Save(dataDir + "MergeDocuments_out.pdf");
}
}
}
Aspose.PDF Merger 是一个在线免费网络应用程序,允许您调查演示合并功能的工作原理。
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.