We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Does Aspose.Pdf support multi threading

Does aspose support multi threading. where we are combining a lot of files

if there is a bad file pdf

it hangs the whole aspose process

i want to be able to tell when aspose has hanged

without the input of a user

Hi Eddie,

Thanks for contacting support.

Aspose.Pdf for .NET can be used in Multi-threaded environment but you cannot access a single file/document in multiple threads.

Now concerning to determining the bad/corrupted PDF file while concatenating PDF files, I am pleased to share that Aspose.Pdf for .NET supports the feature to ignore Corrupted PDF documents during PDF concatenation process. Please note that

The following properties/methods are present in PdfFileEditor:

1. A new Enumeration CorruptedFileActions {StopWithError, ConcatenateIgnoringCorrupted} is added.
2. Property CorruptedFileAction of CorruptedFileActions type is added. This property defines behavior of PDfFileEditor.Concatenate and Append functions when some of files to concatenate/append was corrupted.
  • If CorruptedFileAction is “StopWithError” then process will be stopped and exception thrown or false returned as result of unsuccesful operation (in depend of AllowConcatenateExceptions state)
  • If CorruptFileAction is “ConcatenateIgnoringCorrupted” then only valid files will be concatenated, so the resultant file will be correct too.
Information about corrupted files will be collected and accessible in CorruptedItems property.
No exceptions are throwin in this case (operation is succeded anyway)

3. CorruptedItem class is introduced.
This class has two properties:
  1. int Index - index of corrupted file in parameters array
  2. Exception exception - exception which was encountered for this file to check the reason of failure.
4. CorruptedItem[] CorruptedItems - property which contains information about all corrupted files which were ignored. Please note this array contains information only for corrupted files. If operation was successful, this array will be empty. Corrutped files are not included into resultant files.


Aspose.Pdf.Facades.PdfFileEditor pfe = new Aspose.Pdf.Facades.PdfFileEditor();
pfe.CorruptedFileAction = Aspose.Pdf.Facades.PdfFileEditor.ConcatenateCorruptedFileAction.ConcatenateIgnoringCorrupted;
pfe.Concatenate(new string[] { @“D:\pdfDoc.pdf”, @“D:\pdfDoc_Justified.pdf”, @“D:\TestDoc_corrupt.pdf” }, @“D:\output.pdf”);
if (pfe.CorruptedItems.Length > 0)
Response.Write(“Corrupted documents:” );
foreach (Aspose.Pdf.Facades.PdfFileEditor.CorruptedItem item in pfe.CorruptedItems)
{ Response.Write(item.Index + " reason " + item.Exception.Message); }

else Response.Write(“No corrupted documents”);