I want to combine two PDF documents into one. I have both documents stored in a database, so I retrieve them into byte arrays (C#).
Here is the code I have so far (pdf1 and pdf2 are byte arrays):
-------------
main
PdfDocument outputDocument = new PdfDocument();
AddPages(outputDocument, pdf1)
AddPages(outputDocument, pdf2)
*** now I want to do outputDocument.Save. but to a byte array, not a file ***
>
private void AddPages(PdfDocument outputDocument, byte[] pdfBytes)
 MemoryStream ms = new MemoryStream(pdfBytes); 
PdfDocument inDoc = PdfReader.Open(ms, PdfDocumentOpenMode.Import); 
for (int idx = 0; idx < inDoc.PageCount; idx++)
 // Get the page from the external document. 
PdfPage page = inDoc.Pages[idx]; 
// . and add it to the output document. 
outputDocument.AddPage(page); 
>
>
-------------
What is the syntax to use outputDocument.Save(stream) so I can end up with a byte array of the combined pdfs?