Application hangs when merging two PDF's using Aspose.PDF for VB.NET

Hello,

We have Aspose Total License and we’re trying to merge 8 PDFs of sizes from 12 MB to 115 MBs. It is a console application. Here is the code.

Imports System.IO
Imports Aspose.Pdf
Imports Aspose.Pdf.Facades
Imports Aspose.Pdf.Operator
Imports Aspose.Pdf.Text

Module Module1
Public Const AsposeTotalLicense As String = “Aspose.Total.lic”
Sub Main()

    Dim folderpath As String
    Dim Path As String
    Dim fileStreams As New List(Of IO.Stream)
    Dim outStream As New IO.MemoryStream
    Dim tempInStream As FileStream
    Dim templateStream As New IO.MemoryStream
    folderpath = System.IO.Path.GetFullPath("..\..\") & "Files\"
    Dim _savePath As String = folderpath & "MergeResult_" + (DateTime.UtcNow).ToString("MMddyyhhmmss") + ".pdf"

    SetAsposeLicenses(folderpath)

    Dim filePaths As New List(Of String)

    Path = folderpath + "Schematics Final Design Review Doc_rev A.pdf"

    filePaths.Add(Path)

    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "S-SPO-0104_CDRL_19-15_Integrated_Schematic_Drawing_Package.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "S-SPO-0284_CDRL_19-15_Integrated_Schematic_Drawing_Package_Rev_A5.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "TC3 REV A3.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "TC3 Rev A4.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "TC3 Rev A5.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)

    Path = folderpath + "TCT3_RevA_Draft_14.pdf"
    filePaths.Add(Path)
    tempInStream = New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
    fileStreams.Add(tempInStream)



    Try
        PDFConcat(filePaths, _savePath)
    Catch ex As Exception
    End Try

    'Save Physical File Path
    System.IO.File.WriteAllBytes(_savePath, outStream.ToArray)

End Sub

Public Sub PDFConcat(ByRef streams() As System.IO.Stream, ByRef outstream As System.IO.Stream)
    Dim pdfEditor As New Aspose.Pdf.Facades.PdfFileEditor
    pdfEditor.AllowConcatenateExceptions = True
    pdfEditor.Concatenate(streams, outstream)
End Sub

Public Sub PDFConcat(ByVal files As List(Of String), ByVal outputFile As String)
    Dim pdfEditor As New Aspose.Pdf.Facades.PdfFileEditor
    pdfEditor.Concatenate(files.ToArray(), outputFile)
End Sub

Public Sub SetAsposeLicenses(licensePath As String)
    Try
        Dim totalFilePath As String = FindAsposeLicense(licensePath, AsposeTotalLicense)

        ' Set the pdf license
        Dim pdfLicense As Aspose.Pdf.License = New Aspose.Pdf.License()
        pdfLicense.SetLicense(totalFilePath)
    Catch ex As Exception
        Throw ex
    End Try
End Sub
Private Function FindAsposeLicense(licensePath As String, fileName As String)
    Dim filePath As String = Path.Combine(licensePath, fileName)
    If File.Exists(filePath) Then
        Return filePath
    End If

    Throw New FileNotFoundException(String.Format("Aspose license file '{0}' was not found.", filePath))

End Function

End Module

The problem is it keeps running forever (i7 8th Gen + 8 gb + SSD and ran for some 21 mins). PDF that needed merging sized some 560MBs. Please let me know if there is some workaround for me.

Regards,

@NanduNairSigma,

Thanks for contacting support.

Can you please share source files to further investigate this issue so that we may help you out.

Hi Adnan,

Here you can download the code. PDF files to be merged are in the solution.

https://we.tl/t-kNLb45YwHq

Regards,

@NanduNairSigma

I have observed your issue and like to inform that I have created investigation ticket with ID PDFNET-47885 in our issue tracking system to investigate and resolve this issue as soon possible.

Hello Support Team,

Can we have an update on this?

Thanks

@NanduNairSigma,

I like to inform this issue has been added recently in our issue tracking system and as per our company policy, the first priority for investigation is given to the Paid Support i.e. Enterprise and Priority Support on first come first serve basis. After that the issues from normal support forum are scheduled for investigation on first come first serve basis. I request for your patience and we will share good news with you soon.

Hello Adnan,

This is to inform you that we are also paid customer and our invoice number is 448376. so, please check this ticket as your first priority investigation as per your policy.

Let me update you for the same.

Thanks

@NanduNairSigma,

I like to inform that if you are entitled to priority support than please visit Paid support helpdesk to get your issue resolve as soon as possible.

Hi @Adnan.Ahmad any updates on this?

@NanduNairSigma,

I like to inform that issue is pending for detail investigation. I request for your patience and we will share good news with you soon.

Hi,

Do we have an update on this?

Regards,

@NanduNairSigma,

I regret to inform that we dont have any updates yet on this issue. I request for your patience.

Do we have any ETA when this issue can be fixed?

@NanduNairSigma,

We have planned to investigate this issue in detail and will share good news with you soon.

Hi,

Do we have an update here? Its been open since for last 3 months now.

Regards,

@NanduNairSigma

We would like to share with you that performance related issues are used to be complex in nature and need significant amount of time to get resolved. Along with that, the issues under free support model are resolved on first come first serve basis. Nevertheless, we have logged your concerns and will surely consider them during issue investigation. We will let you know as soon as we have some updates regarding issue rectification. Please give us some time.

We are sorry for the inconvenience.