Question

I'm now trying to create an web application or software, whatever, by c# to achieve a process -- when I scan a piece of paper(contains barcode) using my office scanner, the software or web application will automatically get the the barcode content.

I'm now a bit confusing of how to achieve this. Anyone has idea about this? Do I need to call the Scanner's API or something? My scanner brand is EPSON.

Thanks in advance.

Was it helpful?

Solution

This will give you a general idea on creating your desired application

  • At first you have to capture the image from the scanner using TWAIN or using Windows image Acquistion
  • Then you have to read the bar code from the image.You can use some third party libraries to read the barcode.

Some of the articles that will help you..

OTHER TIPS

Barcode scanners automatically decode the Bars and return a string! Try using in Ms-Word or Notepad. The string is followed by return in some barcode readers.

Actually we do not normally do it coz it will dramatically reduce application performance. Let's say for example, if you scan two files at the same time, the time gap is too short, scanner won't have the mechanism to separate two files.

Thus my suggestion of this would be create a web app, manually upload the document and process.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top