Concatenate PDF files using Streams in VB with Aspose.PDF - 0kb file was created

Hello,

When we try to mailmerge with the documents in the code, it generates the 0kb file.

outstream in this pdfEditor.Concatenate(streams, outstream) gives 0 length.

Attached is the sample application.

Thanks

@NanduNairSigma

Would you kindly share some more details about the process you are running like how you are performing mailmerge. Please share sample code snippet along with sample source document so that we can test the scenario in our environment and address it accordingly.

Hi,
I have attached the dropbox link to download the sample code.

Thanks,

@NanduNairSigma

Thanks for sharing sample application.

We have checked your sample application and noticed that you were using Aspose.Pdf.Facades model to concatenate PDF files. We request you to use recommended Aspose.Pdf (DOM) approach in order to achieve your requirements as we tested using same approach and issue did not occur. Please modify your PDFConcat() method as following:

Public Sub PDFConcat(ByRef streams() As System.IO.Stream, ByRef outstream As System.IO.Stream)
       Dim finaldocument As New Document
       For Each stream As System.IO.Stream In streams
           Dim doc As Document = New Document(stream)
           finaldocument.Pages.Add(doc.Pages)
       Next
       finaldocument.Save(outstream)
End Sub