With Asprise C# VB.NET Scanning & Imaging SDK, you can acquires images from TWAIN WIA scanners and extract barcodes at the same time - even if your scanner doesn't support reading barcode natively.
The code snippet below saves the scanned images into a multi-page PDF file at the current working directory and prints the barcodes recognized:
Result result = new AspriseImaging().Scan(new Request()
.SetTwainCap(TwainConstants.ICAP_PIXELTYPE, TwainConstants.TWPT_RGB) // color mode
.SetTwainCap(TwainConstants.ICAP_SUPPORTEDSIZES, TwainConstants.TWSS_USLETTER) // paper size
.SetRecognizeBarcodes(true)
.AddOutputItem(new RequestOutputItem(AspriseImaging.OUTPUT_SAVE, AspriseImaging.FORMAT_PDF).SetSavePath(".\\${TMS}${EXT}")),
"select", true, true);
List<string> barcodes = result == null ? null : result.GetBarcodes();
Console.WriteLine("Barcodes: " + string.Join(";\n", barcodes == null ? new string[0] : barcodes.ToArray()));
// Alternatively, request can be specified using the following JSON:
{
"twain_cap_setting" :
{
"ICAP_PIXEXELTYPE" : "TWPT_RGB",
"ICAP_SUPPORPORTEDSIZES" : "TWSS_USLESLETTER"
},
"recognize_barcodes" : true,
"output_settings" : [ {
"type" : "save",
"format" : "pdf",
"save_path" : ".\\${TMS}${EXT}" } ]
}
Download and run the reading barcodes while scanning from TWAIN scanners demos here.
Refer to the developer's guide to C# VB.NET scanning and imaging API for more details.