Created
March 6, 2019 11:10
-
-
Save OlafD/3878052b0f5c8b6bc565cf5d37173523 to your computer and use it in GitHub Desktop.
Merge to pdf files from their stream objects into a MemoryStream using Aspose.Pdf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static MemoryStream MergePdfDocuments(Stream pdf1, Stream pdf2) | |
{ | |
MemoryStream result = null; | |
Aspose.Pdf.Document pdf1Document = new Aspose.Pdf.Document(pdf1); | |
Aspose.Pdf.Document pdf2Document = new Aspose.Pdf.Document(pdf2); | |
Aspose.Pdf.Document pdfResult = new Aspose.Pdf.Document(); | |
pdfResult.Pages.Add(pdf1Document.Pages); | |
pdfResult.Pages.Add(pdf2Document.Pages); | |
result = new MemoryStream(); | |
pdfResult.Save(result); | |
result.Position = 0; | |
pdf1Document.Dispose(); | |
pdf2Document.Dispose(); | |
pdfResult.Dispose(); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment