.NET용 1D 바코드 리더
1D 바코드 리더에 대한 소개 .NET
.NET을위한 1D 바코드 리더는 개발자가 이미지를 읽고 해독 할 수있는 강력한 플러그인입니다.이 가이드는 당신이 시작하는 데 도움이 C#에서 코드 예를 제공하여 플러스의 기능과 기능을 통과 할 것입니다.
지원되는 바코드 상징
.NET을 위한 1D 바코드 리더는 다음과 같은 광범위한 범위를 지원합니다:
- UPC - A
- UPC - E
- 에어13
- 에어 8
- 코드 39
- 코드 93
- 코드 128
- 중간 2 의 5
- 코드 11
You can specify the symbology to read using the BarcodeReader
class:
// Create a new instance of BarcodeReader
Aspose.BarCode.BarcodeReader reader = new Aspose.BarCode.BarcodeReader("image.png", Aspose.BarCode DecodeType.Code39);
// Read the barcode
Aspose.BarCode.Result result = reader.ReadBarCodes()[0];
사진에서 바코드 읽기
To read a barcode from an image, you can use the BarcodeReader
class and specify the image file path or stream:
// Create a new instance of BarcodeReader
Aspose.BarCode.BarcodeReader reader = new Aspose.BarCode.BarcodeReader("image.png");
// Read the barcode
Aspose.BarCode.Result result = reader.ReadBarCodes()[0];
또한 스트림에서 바코드를 읽을 수 있습니다 :
// Create a new instance of BarcodeReader
using (System.IO.Stream stream = System.IO.File.OpenRead("image.png"))
{
Aspose.BarCode.BarcodeReader reader = new Aspose.BarCode.BarcodeReader(stream);
// Read the barcode
Aspose.BarCode.Result result = reader.ReadBarCodes()[0];
}
배코드 해독
The BarcodeReader
class returns a Result
object, which contains information about the decoded barcode, including the symbology, code text, and supplement:
// Create a new instance of BarcodeReader
Aspose.BarCode.BarcodeReader reader = new Aspose.BarCode.BarcodeReader("image.png");
// Read the barcode
Aspose.BarCode.Result result = reader.ReadBarCodes()[0];
// Get the symbology
string symbology = result.CodeType;
// Get the code text
string codeText = result.CodeText;
오류 처리
1D Barcode Reader for .NET은 바코드 읽기 또는 해독 중에 오류가 발생하는 경우 예외를 제거합니다.
try
{
// Create a new instance of BarcodeReader
Aspose.BarCode.BarcodeReader reader = new Aspose.BarCode.BarcodeReader("image.png");
// Read the barcode
Aspose.BarCode.Result result = reader.ReadBarCodes()[0];
}
catch (Aspose.BarCode.BarcodeException ex)
{
Console.WriteLine("Error reading barcode: " + ex.Message);
}