Free Support Forum -

Merging two large pdf documents to one takes LONG time

I am converting two large pdf documents one is 800,000 mb, the other is about half the size, 450,000mb into one one pdf. I am using code from example and its taking over 5 minutes to concatenate and its still not done yet.

Here is my function. I need to merge them, then pass the new file string path back to a web app to display the pdf in the browser.

Public Function MergePdfs(ByRef sfiles() As String) As String
Dim oNewPDF As Aspose.Pdf.Document
Dim sOutFile As String = “”
Dim iCnt As Int32 = 0
Dim sTicks As String = Now.Ticks.ToString

        'figure out the path to the files array
        If sfiles.Length > 0 Then
            If File.Exists(sfiles(0)) Then
                Dim oFile As FileInfo = New FileInfo(sfiles(0))
                sOutFile = Path.Combine(oFile.DirectoryName, (sTicks & ".pdf"))
                oFile = Nothing
            End If

            For Each sFile As String In sfiles
                If iCnt = 0 Then
                    oNewPDF = New Aspose.Pdf.Document(sFile)
                End If
                iCnt += 1
                'open the pdf
                Dim openPdfFile As New Aspose.Pdf.Document(sFile)

            Return sOutFile
            Return ""
        End If

        Return sOutFile
    Catch ex As Exception
        oNewPDF = Nothing
    End Try

End Function


Thank you for contacting support.

Please update us if the merging process is completed successfully or some exception like OutOfMemoryException occurs, or if you have to kill the process after several minutes. Since both files exceed 1200 GB so large amount of memory and time will be required to carry out merging process. Can you please try to merge the files using Adobe Acrobat and then share your observations with us. Please also share your environment details with us so that we may investigate to help you out.


the code does not end, and I have to kill the process.
I am also having issue reading a 2.1gb PDF into either aspose.pdf.document, or aspose.pdfFacade.pdfEditor.
I am needing to split this large file into smaller chunks.


Would you please share two huge files that can reproduce this problem in our environment so that we may proceed to help you out.