IronBarcode를 사용하여 C#에서 데이터 형식을 출력하는 방법
IronBarcode는 바코드 읽기에서 다수의 출력 형식을 제공합니다. 여기에는 BarcodeImage, BarcodeType, BinaryValue, 좌표, 크기, 페이지 번호, 방향, 텍스트 및 값 속성이 포함됩니다. 이러한 형식은 다양한 사용 사례에 대해 프로그래밍 방식으로 바코드 데이터를 처리할 수 있게 해줍니다.
단순히 바코드를 읽고 콘솔에 값을 출력하는 대신, IronBarcode는 훨씬 더 많은 기능을 제공합니다. 사용자가 읽은 결과를 처리할 수 있는 여러 출력 형식을 제공합니다. 이 형식에는 바코드 이미지, 바코드 유형, BinaryValue, 좌표, 높이, 너비, 페이지 번호, 바코드, 페이지 방향, text, value 같은 속성이 포함됩니다.
사용자는 프로그램 내에서 이러한 속성을 더욱 조작할 수 있습니다. 이제 이러한 속성 사용 방법과 유용할 수 있는 사용 사례를 살펴보겠습니다.
퀵스타트: 바코드 값 및 타입을 한 줄로 읽기이 예제는 IronBarcode를 사용하여 이미지에서 바코드를 읽는 방법을 보여줍니다 - 한 줄로 바코드를 읽어 들인 다음 값과 유형을 즉시 출력합니다. 빠르게 시작하기에 이상적입니다. 더 포괄적인 예제를 보려면 바코드 빠른 시작 가이드를 확인하세요.
-
1IronBarcode를 NuGet Package Manager로 설치하십시오
-
2다음 코드 조각을 복사하여 실행하세요.
var result = IronBarCode.BarcodeReader.Read("input.png"); Console.WriteLine($"Value: {result[0].Value}, Type: {result[0].BarcodeType}");Dim result = IronBarCode.BarcodeReader.Read("input.png") Console.WriteLine($"Value: {result(0).Value}, Type: {result(0).BarcodeType}")Dim result = IronBarCode.BarcodeReader.Read("input.png") Console.WriteLine($"Value: {result(0).Value}, Type: {result(0).BarcodeType}") -
3실제 운영 환경에서 테스트할 수 있도록 배포하세요.
오늘 프로젝트에서 IronBarcode 사용을 시작해보세요 무료 체험
최소 워크플로우(5단계)
- 바코드를 읽기 위한 C# 라이브러리 다운로드
- 바코드 감지를 위한 PDF 및 이미지 파일을 준비하세요.
- 감지된 바코드 유형 및 이미지에 액세스합니다.
- 바코드의
x및y좌표와height와width를 검색합니다. - 바코드의
text와value를 읽습니다.
사용 가능한 출력 형식 및 그 사용 사례는 무엇입니까?
BarcodeResult는 여러 유용한 속성을 저장합니다. 이러한 속성은 아래와 같습니다:
BarcodeImageBarcodeTypeBinaryValue- 좌표,
Height및Width PageNumberBarcode및PageOrientationText및Value
각 속성은 바코드 처리 워크플로에서 특정 목적을 제공합니다. 재고 관리 시스템, 문서 처리 파이프라인, 품질 관리 애플리케이션을 구축하든 이러한 데이터 형식은 다양한 소스에서 바코드를 읽는 데 필요한 유연성을 제공합니다.
바코드 이미지를 추출하고 저장하는 방법은 무엇입니까?
IronBarcode가 이미지를 읽으면 그 이미지에서 발견된 바코드는 BarcodeResult에 AnyBitmap 유형의 BarcodeImage 속성으로 저장됩니다. BarcodeImage 속성은 발견된 바코드 이미지를 저장합니다. 사용자는 이 객체를 검색하여 이미지를 추가로 처리하거나 영구 복사본으로 저장할 수 있습니다. 이로써 이미지에서 바코드 이미지를 추출하는 추가 코드를 제거하여 효율성과 사용 용이성을 제공합니다.
이 출력 형식의 사용 사례를 보여주는 아래 코드 스니펫을 살펴보세요:
using IronBarCode;
using IronSoftware.Drawing;
using System.Collections.Generic;
// Read barcode from PDF file
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Create list for barcodes
List<AnyBitmap> barcodeList = new List<AnyBitmap>();
foreach (BarcodeResult barcode in result)
{
barcodeList.Add(barcode.BarcodeImage);
}
// Create multi-page TIFF
AnyBitmap.CreateMultiFrameTiff(barcodeList).SaveAs("barcodeImages.tif");using IronBarCode;
using IronSoftware.Drawing;
using System.Collections.Generic;
// Read barcode from PDF file
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Create list for barcodes
List<AnyBitmap> barcodeList = new List<AnyBitmap>();
foreach (BarcodeResult barcode in result)
{
barcodeList.Add(barcode.BarcodeImage);
}
// Create multi-page TIFF
AnyBitmap.CreateMultiFrameTiff(barcodeList).SaveAs("barcodeImages.tif");Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Collections.Generic
' Read barcode from PDF file
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Create list for barcodes
Private barcodeList As New List(Of AnyBitmap)()
For Each barcode As BarcodeResult In result
barcodeList.Add(barcode.BarcodeImage)
Next barcode
' Create multi-page TIFF
AnyBitmap.CreateMultiFrameTiff(barcodeList).SaveAs("barcodeImages.tif")Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Collections.Generic
' Read barcode from PDF file
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Create list for barcodes
Private barcodeList As New List(Of AnyBitmap)()
For Each barcode As BarcodeResult In result
barcodeList.Add(barcode.BarcodeImage)
Next barcode
' Create multi-page TIFF
AnyBitmap.CreateMultiFrameTiff(barcodeList).SaveAs("barcodeImages.tif")위의 코드 스니펫은 이 출력 형식의 한 가지 사용 사례를 보여줍니다. 구체적으로, PDF 문서 내에서 감지된 바코드로부터 다중 페이지 TIFF 이미지를 생성합니다. 첫째, 샘플 PDF에서 바코드를 스캔하거나 감지합니다. 그런 다음 AnyBitmap 목록을 생성하여 BarcodeImage 속성의 정보를 저장합니다. 마지막으로 이 목록을 사용하여 CreateMultiFrameTiff 메서드를 사용하여 다중 페이지 TIFF를 생성합니다. 이 기술은 다중 페이지 GIF 및 TIFF 파일을 처리할 때 특히 유용합니다.
BarcodeImage 속성은 BarcodeResult에서 코드 읽기 동안 발견된 바코드의 이미지만 저장하며, 전체 입력 이미지는 저장하지 않습니다.프로그래밍 방식으로 다양한 바코드 타입을 식별하는 방법은 무엇입니까?
이 속성은 입력 이미지나 문서에 어떤 유형의 바코드가 있는지 판별하는 데 도움이 됩니다. 그러나 제한점은 이미지 내의 바코드 유형이 IronBarcode에 의해 지원되고 읽을 수 있어야 한다는 것입니다. IronBarcode에서 지원되는 바코드 유형에 대해 자세히 알아보려면 이 기사를 참조하세요. 또한 특정 요구 사항과의 호환성을 보장하기 위해 지원되는 바코드 형식의 전체 목록을 탐색하세요.
아래의 코드 스니펫은 이미지의 바코드 값과 바코드 유형을 콘솔에 출력함으로써 바코드 값을 검색하는 방법을 보여줍니다.
using IronBarCode;
using System;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("bc3.png");
// Output barcode type to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine("The barcode value is " + barcode.ToString() + " and the barcode type is " + barcode.BarcodeType);
}using IronBarCode;
using System;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("bc3.png");
// Output barcode type to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine("The barcode value is " + barcode.ToString() + " and the barcode type is " + barcode.BarcodeType);
}Imports IronBarCode
Imports System
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("bc3.png")
' Output barcode type to console
For Each barcode As BarcodeResult In result
Console.WriteLine("The barcode value is " & barcode.ToString() & " and the barcode type is " & barcode.BarcodeType)
Next barcodeImports IronBarCode
Imports System
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("bc3.png")
' Output barcode type to console
For Each barcode As BarcodeResult In result
Console.WriteLine("The barcode value is " & barcode.ToString() & " and the barcode type is " & barcode.BarcodeType)
Next barcode위의 코드 스니펫에서 BarcodeReader.Read() 메서드를 호출하여 입력 이미지에서 바코드를 읽습니다. 이것은 이미지에서 모든 바코드를 읽어들이고 BarcodeResult를 저장하는 BarcodeResults 객체를 반환합니다. 다음으로, BarcodeResults 객체를 반복하여 BarcodeResult를 검색하고 바코드 value 및 type을 콘솔에 출력합니다. 이 접근 방식은 Code 39 바코드와 같은 특수 형식을 포함한 다양한 바코드 유형에서 작동합니다.
언제 이진 값 출력을 사용해야 합니까?
IronBarcode를 사용하여 사용자는 BarcodeResult 객체에서 BinaryValue 속성을 액세스하여 바코드 value의 바이트 배열을 검색할 수 있습니다. 이것은 프로그램 내에서 바코드 value를 추가로 조작할 수 있도록 합니다. 바이너리 value 출력은 암호화된 데이터, 바코드에 인코딩된 첨부 파일 또는 바이트 수준 데이터 처리가 필요한 시스템과 통합할 때 특히 유용합니다.
아래 코드 스니펫은 바코드 value를 이진 데이터로 검색하는 한 가지 사용 사례를 보여줍니다:
using IronBarCode;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("multiple-barcodes.png");
int i = 1;
foreach (BarcodeResult barcode in result)
{
var binaryValue = barcode.BinaryValue;
var barcodeType = IronBarCode.BarcodeEncoding.QRCode;
// Create QR code
GeneratedBarcode generatedBarcode = BarcodeWriter.CreateBarcode(binaryValue, barcodeType);
// Export QR code
generatedBarcode.SaveAsPng($"qrFromBinary{i}.png");
i++;
}using IronBarCode;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("multiple-barcodes.png");
int i = 1;
foreach (BarcodeResult barcode in result)
{
var binaryValue = barcode.BinaryValue;
var barcodeType = IronBarCode.BarcodeEncoding.QRCode;
// Create QR code
GeneratedBarcode generatedBarcode = BarcodeWriter.CreateBarcode(binaryValue, barcodeType);
// Export QR code
generatedBarcode.SaveAsPng($"qrFromBinary{i}.png");
i++;
}Imports IronBarCode
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("multiple-barcodes.png")
Private i As Integer = 1
For Each barcode As BarcodeResult In result
Dim binaryValue = barcode.BinaryValue
Dim barcodeType = IronBarCode.BarcodeEncoding.QRCode
' Create QR code
Dim generatedBarcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(binaryValue, barcodeType)
' Export QR code
generatedBarcode.SaveAsPng($"qrFromBinary{i}.png")
i += 1
Next barcodeImports IronBarCode
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("multiple-barcodes.png")
Private i As Integer = 1
For Each barcode As BarcodeResult In result
Dim binaryValue = barcode.BinaryValue
Dim barcodeType = IronBarCode.BarcodeEncoding.QRCode
' Create QR code
Dim generatedBarcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(binaryValue, barcodeType)
' Export QR code
generatedBarcode.SaveAsPng($"qrFromBinary{i}.png")
i += 1
Next barcode위의 코드 스니펫을 관찰하면 이미지 내 여러 바코드를 개별 새 이진 인코딩 파일로 변환하는 간단한 프로그램을 만들었습니다. 먼저 샘플 PNG 이미지에서 바코드를 스캔합니다. 바코드를 감지한 후 각 바코드를 순회하며 BinaryValue 속성에 접근하고, 해당 값을 사용하여 새 이진 파일을 만듭니다. 이 기술은 여러 바코드를 읽고 각각의 이진 데이터를 개별적으로 처리해야 할 때 특히 유용합니다.
바코드 위치 및 크기에 어떻게 액세스할 수 있습니까?
사용자가 액세스할 수 있는 BarcodeResult 객체의 또 다른 속성은 Points 속성(바코드의 모서리 좌표의 PointF[])을 통해 바코드의 위치와 이미지 파일 또는 문서 내에서의 Height 및 Width입니다. 이 속성은 사용자가 바코드의 위치와 크기에 대한 정보를 가져와야 할 때 유용합니다. 이 공간 정보는 자동 문서 처리, 품질 관리 시스템 또는 최적화된 바코드 스캔을 위한 크롭 영역을 구현할 때와 같은 정확한 위치를 요구하는 애플리케이션에서 중요합니다.
바코드의 위치와 크기를 보여드리겠습니다.
using IronBarCode;
using IronSoftware.Drawing;
using System.Linq;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("multiple-barcodes.png");
AnyBitmap bitmap = AnyBitmap.FromFile("multiple-barcodes.png");
foreach (BarcodeResult barcode in result)
{
PointF[] barcodePoints = barcode.Points;
float x1 = barcodePoints.Select(b => b.X).Min();
float y1 = barcodePoints.Select(b => b.Y).Min();
Rectangle rectangle = new Rectangle((int)x1, (int)y1, (int)barcode.Width!, (int)barcode.Height!);
bitmap = bitmap.Redact(rectangle, Color.Magenta);
// Save the image
bitmap.SaveAs("redacted.png", AnyBitmap.ImageFormat.Png);
}using IronBarCode;
using IronSoftware.Drawing;
using System.Linq;
// Read barcode from PNG
BarcodeResults result = BarcodeReader.Read("multiple-barcodes.png");
AnyBitmap bitmap = AnyBitmap.FromFile("multiple-barcodes.png");
foreach (BarcodeResult barcode in result)
{
PointF[] barcodePoints = barcode.Points;
float x1 = barcodePoints.Select(b => b.X).Min();
float y1 = barcodePoints.Select(b => b.Y).Min();
Rectangle rectangle = new Rectangle((int)x1, (int)y1, (int)barcode.Width!, (int)barcode.Height!);
bitmap = bitmap.Redact(rectangle, Color.Magenta);
// Save the image
bitmap.SaveAs("redacted.png", AnyBitmap.ImageFormat.Png);
}Imports System
Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Linq
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("multiple-barcodes.png")
Private bitmap As AnyBitmap = AnyBitmap.FromFile("multiple-barcodes.png")
For Each barcode As BarcodeResult In result
Dim barcodePoints() As PointF = barcode.Points
Dim x1 As Single = barcodePoints.Select(Function(b) b.X).Min()
Dim y1 As Single = barcodePoints.Select(Function(b) b.Y).Min()
'INSTANT VB TODO TASK: There is no VB equivalent to the C# 'null-forgiving operator':
'ORIGINAL LINE: Rectangle rectangle = new Rectangle((int)x1, (int)y1, (int)barcode.Width!, (int)barcode.Height!);
Dim rectangle As New Rectangle(CInt(Math.Truncate(x1)), CInt(Math.Truncate(y1)), CInt(barcode.Width), CInt(barcode.Height))
bitmap = bitmap.Redact(rectangle, Color.Magenta)
' Save the image
bitmap.SaveAs("redacted.png", AnyBitmap.ImageFormat.Png)
Next barcodeImports System
Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Linq
' Read barcode from PNG
Private result As BarcodeResults = BarcodeReader.Read("multiple-barcodes.png")
Private bitmap As AnyBitmap = AnyBitmap.FromFile("multiple-barcodes.png")
For Each barcode As BarcodeResult In result
Dim barcodePoints() As PointF = barcode.Points
Dim x1 As Single = barcodePoints.Select(Function(b) b.X).Min()
Dim y1 As Single = barcodePoints.Select(Function(b) b.Y).Min()
'INSTANT VB TODO TASK: There is no VB equivalent to the C# 'null-forgiving operator':
'ORIGINAL LINE: Rectangle rectangle = new Rectangle((int)x1, (int)y1, (int)barcode.Width!, (int)barcode.Height!);
Dim rectangle As New Rectangle(CInt(Math.Truncate(x1)), CInt(Math.Truncate(y1)), CInt(barcode.Width), CInt(barcode.Height))
bitmap = bitmap.Redact(rectangle, Color.Magenta)
' Save the image
bitmap.SaveAs("redacted.png", AnyBitmap.ImageFormat.Png)
Next barcode
마스킹 전

마스킹 후
위의 코드 스니펫은 이미지 파일에서 발견된 여러 바코드를 마스킹합니다. 이를 위해 IronBarcode와 IronDrawing 두 개의 라이브러리를 조합하여 사용합니다. BarcodeReader.Read() 메서드를 사용하여 이미지 파일에서 사용할 수 있는 바코드를 먼저 읽어 BarcodeResult 객체를 얻고 그 속성을 추출합니다. 동시에, 입력 이미지 파일은 AnyBitmap 객체로 변환되어야 이미지에 마스킹 메서드를 적용할 수 있습니다. BarcodeResults 객체를 얻으면, 루프를 적용하여 이를 반복하면서 이미지에 있는 각 바코드의 Points, Width 및 Height를 얻을 수 있습니다. 각 바코드의 좌상단 x1/y1 모서리를 Points로부터 파생시켜 AnyBitmap.Redact() 메서드의 CropRectangle 속성에 사용할 수 있습니다.
왜 다중 페이지 문서에서 페이지 번호가 중요한가요?
사용자는 바코드가 발견된 페이지 번호를 검색할 수 있습니다. 이는 다중 바코드를 포함하는 다중 페이지 문서를 사용하고 문서 내 발견된 바코드의 위치를 추가 처리 목적으로 알아야 하는 사용자에게 유용한 기능입니다. 이 기능은 PDF 문서에서 바코드를 읽거나 기업 애플리케이션에서 배치 문서를 처리할 때 필수적입니다.
아래의 코드 스니펫을 보십시오:
using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Output page number to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine("The barcode value " + barcode.ToString() + " is found on page number " + barcode.PageNumber);
}using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Output page number to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine("The barcode value " + barcode.ToString() + " is found on page number " + barcode.PageNumber);
}Imports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Output page number to console
For Each barcode As BarcodeResult In result
Console.WriteLine("The barcode value " & barcode.ToString() & " is found on page number " & barcode.PageNumber)
Next barcodeImports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Output page number to console
For Each barcode As BarcodeResult In result
Console.WriteLine("The barcode value " & barcode.ToString() & " is found on page number " & barcode.PageNumber)
Next barcode위의 코드 스니펫은 사용자가 다중 페이지 PDF 문서에서 발견된 바코드의 value와 해당 페이지 번호를 반환하도록 프로그램을 필요로 하는 한 가지 사용 사례를 보여줍니다. 그 코드는 BarcodeReader.ReadPdf() 메서드를 사용하여 다중 페이지 PDF 문서 내의 바코드를 읽습니다. 이는 문서에서 발견된 모든 BarcodeResult를 저장하는 BarcodeResults 객체를 반환합니다. 객체의 각 항목을 반복하여 바코드의 value와 바코드가 발견된 페이지 번호를 검색합니다. 이 사용 사례 외에도 사용자는 이 속성을 사용하여 문서의 모든 바코드가 읽혔는지 디버그할 수 있습니다.
바코드 회전 및 페이지 방향을 어떻게 감지하나요?
IronBarcode를 사용하여 사용자는 바코드 방향과 바코드가 발견된 페이지 방향 정보를 검색할 수 있습니다. 이 두 정보를 추출하려면 BarcodeResult 객체에서 Rotation과 PageOrientation 속성을 액세스하세요. Rotation은 발견된 바코드의 회전 각도를 나타내는 정수를 반환합니다. 이 기능은 이미지 방향 수정 기능과 함께 작동하여 스캔 각도에 관계없이 올바른 바코드 읽기를 보장합니다.
아래의 코드 스니펫을 보십시오:
using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Output page orientation and rotation to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine(barcode.Value);
Console.WriteLine(barcode.PageOrientation);
Console.WriteLine(barcode.Rotation);
}using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("test.pdf");
// Output page orientation and rotation to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine(barcode.Value);
Console.WriteLine(barcode.PageOrientation);
Console.WriteLine(barcode.Rotation);
}Imports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Output page orientation and rotation to console
For Each barcode As BarcodeResult In result
Console.WriteLine(barcode.Value)
Console.WriteLine(barcode.PageOrientation)
Console.WriteLine(barcode.Rotation)
Next barcodeImports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("test.pdf")
' Output page orientation and rotation to console
For Each barcode As BarcodeResult In result
Console.WriteLine(barcode.Value)
Console.WriteLine(barcode.PageOrientation)
Console.WriteLine(barcode.Rotation)
Next barcode위의 코드 스니펫은 첨부된 샘플 PDF 입력으로 실행되어 사용자가 페이지 방향을 검색하고 pageOrientation 및 바코드 rotation을 각각 얻을 수 있음을 증명합니다. 이 기능은 주로 디버깅 목적으로 유용합니다.
BarcodeResult.PageOrientation, BarcodeResult.Rotation, 0, 90, 180, 및 270 도수의 회전이 있는 바코드만 읽을 수 있습니다. IronBarcode는 언급된 회전 값이 아닌 경우 어떤 값도 반환하지 않습니다. PageOrientation은 Portrait 또는 Landscape로 구성된 PageOrientation 객체를 반환합니다.텍스트와 값 속성의 차이점은 무엇입니까?
물론, IronBarcode를 사용할 때 사용자가 검색하고자 하는 주요 속성은 value 및 text입니다. 이 두 속성은 종종 상호 교환적으로 사용되며 동일한 value를 반환합니다. 그 외에도 사용자는 동일한 결과를 얻기 위해 BarcodeResult.ToString() 메서드를 사용할 수 있습니다. 특수 애플리케이션을 다루거나 바코드 데이터를 스트림으로 내보낼 때, 이러한 속성은 바코드 콘텐츠를 선호하는 형식으로 액세스할 수 있는 유연한 방법을 제공합니다.
아래의 코드 스니펫을 참고하세요:
using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("barcodestamped3.pdf");
// Output text value to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine(barcode.Value);
Console.WriteLine(barcode.Text);
Console.WriteLine(barcode.ToString());
}using IronBarCode;
using System;
// Read barcode from PDF
BarcodeResults result = BarcodeReader.ReadPdf("barcodestamped3.pdf");
// Output text value to console
foreach (BarcodeResult barcode in result)
{
Console.WriteLine(barcode.Value);
Console.WriteLine(barcode.Text);
Console.WriteLine(barcode.ToString());
}Imports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("barcodestamped3.pdf")
' Output text value to console
For Each barcode As BarcodeResult In result
Console.WriteLine(barcode.Value)
Console.WriteLine(barcode.Text)
Console.WriteLine(barcode.ToString())
Next barcodeImports IronBarCode
Imports System
' Read barcode from PDF
Private result As BarcodeResults = BarcodeReader.ReadPdf("barcodestamped3.pdf")
' Output text value to console
For Each barcode As BarcodeResult In result
Console.WriteLine(barcode.Value)
Console.WriteLine(barcode.Text)
Console.WriteLine(barcode.ToString())
Next barcode위의 코드 스니펫에서 사용자들은 IronBarcode를 사용하여 이미지에서 바코드를 읽기 위해 몇 줄의 코드만 필요합니다. BarcodeReader.Read() 메서드에 의해 반환된 BarcodeResults를 반복한 후, 콘솔에 Value 및 Text 속성의 결과를 출력하고, 모든 것이 같은 value를 반환하는지 보여주기 위해 BarcodeResult.ToString() 메서드를 호출합니다.
한마디로, IronBarcode는 사용자들이 바코드에 관한 여러 작업을 수행할 수 있는 완벽한 API로, 바코드 작성 및 디코딩에만 국한되지 않습니다. 여러 출력 데이터 형식을 지원하여 사용자는 IronBarcode가 반환한 BarcodeResult 객체로 더 많은 작업을 수행할 수 있습니다.
자주 묻는 질문
IronBarcode에서 사용 가능한 바코드 출력 형식은 무엇인가요?
IronBarcode는 .NET 애플리케이션의 다양한 데이터 처리 요구를 돕기 위해 BarcodeImage, BarcodeType, BinaryValue, 좌표, 크기, 페이지 번호, 방향, 텍스트, 값 속성과 같은 여러 출력 형식을 제공합니다.
바코드의 값과 유형을 어떻게 읽고 즉시 출력할 수 있나요?
IronBarcode를 사용하면 이미지에서 바코드를 읽고 즉시 값과 유형을 출력하는 코드를 한 줄로 작성할 수 있습니다. 예를 들어: var result = IronBarCode.BarcodeReader.Read("input.png"); Console.WriteLine($"Value: {result[0].Value}, Type: {result[0].BarcodeType}");
IronBarcode를 사용하여 바코드 이미지를 어떻게 추출하고 저장할 수 있나요?
바코드를 읽은 후에는 BarcodeImage 속성을 사용하여 이미지를 접근할 수 있습니다. 그런 다음 IronBarcode 도구를 사용하여 이 이미지를 처리하거나 저장할 수 있습니다.
바코드 처리에서 BinaryValue 출력은 어떤 용도로 사용되나요?
BinaryValue는 바코드의 바이트 배열을 검색할 수 있도록 하여, 특히 암호화된 데이터를 처리하거나 바이트 수준 데이터 조작이 필요한 시스템과의 통합에 유용합니다.
이미지 내 바코드의 위치와 크기를 어떻게 확인할 수 있나요?
IronBarcode는 바코드의 위치와 크기를 결정할 수 있는 Points, Height, Width와 같은 속성을 제공하여 정밀한 공간 데이터를 필요로 하는 애플리케이션을 지원합니다.
여러 페이지 문서에서 페이지 번호 정보가 중요한 이유는 무엇인가요?
페이지 번호 정보는 여러 페이지 문서에서 각 바코드가 위치한 지점을 식별하는 데 도움을 주어, 많은 바코드가 있는 문서의 효율적인 처리 및 디버깅을 가능하게 합니다.
IronBarcode는 바코드 회전 및 페이지 방향을 어떻게 처리하나요?
IronBarcode는 회전 및 페이지 방향 속성을 제공하여, 회전되었거나 서로 다른 방향의 페이지에 있는 바코드를 식별하고 정확하게 처리할 수 있도록 도와줍니다.
IronBarcode에서 Text와 Value 속성의 차이점은 무엇인가요?
Text와 Value 속성은 일반적으로 바코드의 내용을 나타내는 동일한 데이터를 반환하지만, 선호하는 형식으로 바코드 정보를 액세스할 수 있는 유연성을 제공합니다.
어떤 애플리케이션이 IronBarcode의 출력 데이터 형식 사용으로 혜택을 받나요?
재고 관리, 문서 처리, 품질 관리 분야의 애플리케이션은 IronBarcode의 다양한 데이터 형식이 제공하는 광범위한 바코드 데이터 처리 옵션으로 크게 혜택을 받을 수 있습니다.
IronBarcode가 여러 페이지 PDF 문서에서 바코드를 읽을 수 있나요?
네, IronBarcode는 BarcodeReader.ReadPdf()와 같은 메서드를 사용하여 여러 페이지 PDF 문서에서 바코드를 읽을 수 있으며, 각 바코드가 발견된 페이지 번호에 대한 정보도 제공합니다.