Hi,
I am using free Spire.Barcode library.
While scanning barcodes from image, Scan function is taking significant time to return results.
If the image has complex/ more data, time exceeds more than 25 seconds per page, that is quite a large.
Please help me to improve scan speed. My code is below
int ZoomFactor=3;
Stream stream1 = new FileStream(FileName, FileMode.Open, FileAccess.Read);
PdfLoadedDocument ldoc = new PdfLoadedDocument(stream1);
try
{
for (int i = 0; i < ldoc.Pages.Count; i++)
{
SizeF pageSize = ldoc.Pages[i].Size;
Bitmap img = ldoc.ExportAsImage(i, new SizeF(pageSize.Width * ZoomFactor, pageSize.Height * ZoomFactor), true);
string[] str = Spire.Barcode.BarcodeScanner.Scan(img, Spire.Barcode.BarCodeType.Code128);
foreach (string item in str)
{
txtProcessed.Text += item + "; ";
}
img.Dispose();
img = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
stream1.Close();
stream1.Dispose();
ldoc.Close();
ldoc.Dispose();
}
catch (Exception )
{
}
finally
{
stream1.Close();
stream1.Dispose();
ldoc.Close();
ldoc.Dispose();
}