officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor-dot-appenddocument-x28-system-dot-string-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Appends a PDF document located at the specified path to the end of the current document starting from the new page.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void AppendDocument(
string path
)
Public Sub AppendDocument(
path As String
)
| Name | Type | Description |
|---|---|---|
| path | String |
A String value, specifying the location of the appended document.
|
All additional content (interactive forms, bookmarks,hyperlinks, file attachments, etc.) of the appended document is copied to the resulting file.
This example illustrates how to use the PDF Document API component to merge pages of two separate PDF documents into a single PDF document.
using DevExpress.Pdf;
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor()) {
pdfDocumentProcessor.CreateEmptyDocument("..\\..\\docs\\Merged.pdf");
pdfDocumentProcessor.AppendDocument("..\\..\\docs\\TextMerge1.pdf");
pdfDocumentProcessor.AppendDocument("..\\..\\docs\\TextMerge2.pdf");
}
Imports DevExpress.Pdf
Using pdfDocumentProcessor As New PdfDocumentProcessor()
pdfDocumentProcessor.CreateEmptyDocument("..\..\docs\Merged.pdf")
pdfDocumentProcessor.AppendDocument("..\..\docs\TextMerge1.pdf")
pdfDocumentProcessor.AppendDocument("..\..\docs\TextMerge2.pdf")
End Using
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AppendDocument(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
pdf-document-api-merge-multiple-documents/CS/PdfMergeExample/Program.cs#L14
pdfDocumentProcessor.CreateEmptyDocument("Merged.pdf");
pdfDocumentProcessor.AppendDocument("..\\..\\..\\docs\\TextMerge1.pdf");
pdfDocumentProcessor.AppendDocument("..\\..\\..\\docs\\TextMerge2.pdf");
pdf-document-api-merge-multiple-documents/VB/PdfMergeExample/Program.vb#L10
pdfDocumentProcessor.CreateEmptyDocument("Merged.pdf")
pdfDocumentProcessor.AppendDocument("..\..\docs\TextMerge1.pdf")
pdfDocumentProcessor.AppendDocument("..\..\docs\TextMerge2.pdf")
See Also