Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Merge PDF Files - Aspose.PDF for .NET
// create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
// output stream
FileStream outputStream = new FileStream("Merged.pdf", FileMode.Create);
// create array of Streams
FileStream[] streamArray = new FileStream[3];
streamArray[0] = new FileStream("file1.pdf", FileMode.Open);
streamArray[1] = new FileStream("file2.pdf", FileMode.Open);
streamArray[2] = new FileStream("file3.pdf", FileMode.Open);
// merge files
pdfEditor.Concatenate(streamArray, outputStream);
// create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
// create array of PDF files' paths
string[] filesArray = new string[3];
filesArray[0] = "file1.pdf";
filesArray[1] = "file2.pdf";
filesArray[2] = "file3.pdf";
// merge files
pdfEditor.Concatenate(filesArray, "merged.pdf");
// create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
// output stream
FileStream outputStream = new FileStream("Merged.pdf", FileMode.Create);
// input streams
FileStream inputStream1 = new FileStream("file1.pdf", FileMode.Open);
FileStream inputStream2 = new FileStream("file2.pdf", FileMode.Open);
// merge files
pdfEditor.Concatenate(inputStream1, inputStream2, outputStream);
// create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
// merge files
pdfEditor.Concatenate("file1.pdf", "file2.pdf", "merged.pdf");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.