Free Support Forum - aspose.com

Thread abortion occured while concatinating pdf files

Sir:

I was running asynchronous process for contatinating two pdf files - one is 22 mb size and second is 1 mb.

But it threw an exception like "Thread abortion occured". Here is my code:

public void MergePDF( string pdf1, string pdf2, string sOutputPDF )

{

FileStream inStream1 = new FileStream(pdf1, FileMode.Open);

FileStream inStream2 = new FileStream(pdf2, FileMode.Open);

FileStream outStream = new FileStream(sOutputPDF, FileMode.Create);

try

{

PdfFileEditor pdfEditor = new PdfFileEditor();

Stream[] inStreams = new Stream[] { inStream1, inStream2 };

pdfEditor.Concatenate(inStreams, outStream);

pdfEditor = null;

}

catch (Exception ex)

{

string msg = ex.Message;

}

finally

{

outStream.Close();

inStream1.Close();

inStream2.Close();

outStream.Dispose();

inStream1.Dispose();

inStream2.Dispose();

}

}

Hi,

Please share the problematic PDF files with us, so we could test the issue at our end. We’ll update you with the results accordingly.

We’re sorry for the inconvenience.
Regards,