IronBarcode가 MSI 바코드를 인식할 수 없음

Curtis Chau
Curtis Chau
업데이트됨: 2026년 7월 6일

문제

IronBarcode 라이브러리를 사용하여 MSI 바코드를 생성할 때, BarcodeReader.Read 메서드가 생성된 MSI 바코드를 읽을 수 없는 경우가 있을 수 있으며, 이로 인해 스캔이 비어 있고 바코드에서 예상한 값이 나오지 않을 수 있습니다.

해결책

MSI 바코드를 BarcodeReader.Read가 읽을 수 있도록 보장하기 위해, 우리는 Read 메서드에 대해 부가적인 선택적 BarcodeReaderOptions 매개변수를 제공해야 합니다. BarcodeReaderOptions 내에서 우리는 읽으려는 바코드 유형을 명시적으로 지정하고 ExpectBarcodeTypes 값을 할당합니다. 이렇게 하면, Read 메서드는 IronBarcode에서 생성된 MSI 바코드뿐만 아니라 다른 외부의 MSI 바코드도 인식할 수 있습니다.

아래는 BarcodeReaderOptions을 BarcodeReader.Read에 적용하는 빠른 예시입니다.

코드 예제

// Creating MSI Barcode with the value "12345"
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.MSI);

// Save barcode as image
myBarcode.SaveAsImage("msi.png");


// Reading MSI
var barcodeReaderOptions = new BarcodeReaderOptions
{
     // Assigning BarcodeEncoding.MSI to ExpectBarcodeType to ensure that IronBarcode expects MSI type barcodes specifically 
  ExpectBarcodeTypes = BarcodeEncoding.MSI,
};

// Read barcode with additional barcodeReaderOptions from above
var barcodeResults = BarcodeReader.Read("msi.png", barcodeReaderOptions);

// Using a for loop and print out the result 
foreach (BarcodeResult result in barcodeResults)
{
  Console.WriteLine(result.Text);
    // Output: 12345 
}

예시에서, 먼저 새로운 BarcodeReaderOptions 변수를 생성한 후, ExpectBarcodeTypes을 (는) BarcodeEncoding.MSI 열거형으로 지정하여 IronBarcode가 MSI 바코드를 기대하도록 지시합니다. 그 후, barcodeResults이 (가) BarcodeResults 배열을 반환하고 각 결과에 대해 텍스트 값을 반복문을 통해 얻으면서 바코드의 값을 출력합니다. 값은 12345가 될 것입니다.

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

더 읽기

시작할 준비 되셨나요?

NuGet 다운로드 수 2,575,633버전:2026.11방금 출시