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)