Extract Failing

HI,
I have code working fine in a main thread of an application however when the SAME CODE is run in a multi-threaded environment I am unable to extract anything except for the first page of the PDF document stream passed using PDF Editor. I just want each page to be able to feed into Aspose.Barcode to detect Barcodes on the pages.

Can you please shed any light on this?
Aspose.Pdf.Facades.PdfFileEditor ed = new Aspose.Pdf.Facades.PdfFileEditor();
MemoryStream imageStream;
FileStream pdfstream = File.OpenRead(filename);
for (int i = 1; i <= maxpages; i++)
{
imageStream = new MemoryStream();
ed.Extract(pdfstream, i, i, imageStream);
if (imageStream.Length == 0)
{ // there is no more pages so exit cleanly
break;
}
// Process page using barcode
}

In the example above for any value of i above 1 the length of the stream returned is zero BUT I know there are 13 pages.

I have even tried initialising the extractor and opening the PDF file every loop but it makes no difference. Only the first page can be extracted.

I have downloaded the latest version and now only the first 4 pages are extracted from my 10 page PDF. I have not included the DLL in the project to save on space. As you can see this project has the an issue and is NOT multi-threaded which I believed was may issue originally. Strangely in my other project with identical code I do not get the issue…The difference however is dealing with a file accessed using the DragDrop feature I will investigate further…

ConsoleApp1.zip (7.5 MB)

@ggnuttall

Could you please share a sample console application where multi-threading is implementing. We will test the scenario in our environment and address it accordingly. Also, please note that it is advised to process one PDF in single thread (Document should be accessed only by one thread at a time) in a multithreading environment. Please share the sample PDF document with us as well if issue still persists.

I have added a sample console application that highlights the problem even in a single threaded application.

@ggnuttall

We tested your application with Aspose.PDF for .NET 20.8 and were unable to notice the issue that you have mentioned. Would you please make sure that you are using latest version of the API. In case you still face any issue, please share some more details with us so that we can replicate the issue in our environment and address it accordingly.

Yes - I just noticed that the 4 page issue was related to using the trial version. I will aim to replicate the THREADING issue and come back to you…

@ggnuttall

Please take your time to prepare a sample project for us so that we can replicate the issue.