Search Results for

    Show / Hide Table of Contents

    Class BarcodeResult

    Result from reading a barcode using IronBarCode

    Inheritance
    System.Object
    BarcodeResult
    Namespace: IronBarCode
    Assembly: IronBarCode.dll
    Syntax
    public class BarcodeResult : Object

    BarcodeResult is the record a developer reads after a scan succeeds: one decoded barcode, with its text, its symbology, and where it sat in the source. A BarcodeReader.Read call returns a BarcodeResults collection of these, one per code found, so this is the type whose properties a developer actually consumes once the read is done. It answers "how do I get the value of a scanned barcode in C#" and the follow-ups about type and position.

    A developer does not construct BarcodeResult for a normal read; the reader produces it. After calling Read or ReadAsync, iterate the returned BarcodeResults and inspect each BarcodeResult in turn. Because one image or PDF page can hold several codes, treat the result as one entry among possibly many rather than assuming a single hit.

    The decoded payload is the first thing to read. Value and Text give the decoded string, BinaryValue exposes the raw bytes for non-text payloads, and Url parses the value as a Uri when the code holds a link. The symbology is BarcodeType, a BarcodeEncoding that names the format detected, such as QR, Code 128, or Code 39. The location and geometry are Points, the corner coordinates as a PointF array, plus Rotation, Width, and Height, which describe how the symbol was oriented and sized in the image. For multi-page sources, PageNumber and PageOrientation report which page the code came from and how that page was turned. BarcodeImage exposes the cropped image of the detected code itself. Read Value for the common case, and reach for the geometry and page properties when a job needs to locate or annotate the code.

    using IronBarCode;
    
    foreach (BarcodeResult result in BarcodeReader.Read("barcode.png"))
        Console.WriteLine($"{result.BarcodeType}: {result.Value}");

    The read barcodes from images how-to reads codes and consumes the results, the read multiple barcodes how-to iterates several results, and the reading barcodes tutorial covers the end-to-end read.

    Constructors

    BarcodeResult()

    Initializes a new instance of the BarcodeResults class.

    Declaration
    public BarcodeResult()

    BarcodeResult(PointF[], String)

    Initializes a new instance of the BarcodeResults class.

    Declaration
    public BarcodeResult(PointF[] points, string value)
    Parameters
    Type Name Description
    IronSoftware.Drawing.PointF[] points
    System.String value

    Properties

    BarcodeImage

    An image of the scanned barcode image as a IronSoftware.Drawing.AnyBitmap.

    This IronSoftware.Drawing.AnyBitmap will be disposed when the BarcodeResult finalizes. If you wish to keep a permanent copy of the BarcodeImage use the (Bitmap)BarcodeResult.BarcodeImage.Clone() method.

    Declaration
    public AnyBitmap BarcodeImage { get; }
    Property Value
    Type Description
    IronSoftware.Drawing.AnyBitmap

    An image of the barcode which was read.

    BarcodeType

    The BarcodeEncoding (barcode type) which was detected

    Declaration
    public BarcodeEncoding BarcodeType { get; }
    Property Value
    Type Description
    BarcodeEncoding

    BinaryValue

    The binary value of the barcode as a byte array.

    Declaration
    public byte[] BinaryValue { get; }
    Property Value
    Type Description
    System.Byte[]

    Height

    A Barcode Height

    Declaration
    public Nullable<int> Height { get; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    PageNumber

    The page number of the PDF or Image in which the barcode was discovered. The page numbers are 1-based indexed, meaning the first page is '1' rather than '0'.

    Declaration
    public int PageNumber { get; }
    Property Value
    Type Description
    System.Int32

    PageOrientation

    A Page orientation of input image.

    Declaration
    public PageOrientation PageOrientation { get; }
    Property Value
    Type Description
    PageOrientation

    Points

    Points defining the corners of the detected barcode code.

    Declaration
    public PointF[] Points { get; }
    Property Value
    Type Description
    IronSoftware.Drawing.PointF[]

    Rotation

    Clockwise rotation of the barcode from a horizontal position. Setting AutoRotate to true in BarcodeReaderOptions gives the angle in multiples of 15, while setting it to false gives it in multiples of 90. Null signifies the orientation was not found.

    Declaration
    public Nullable<int> Rotation { get; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Text

    The value of the barcode as a string. Synonym for BarcodeResult.Value

    Declaration
    public string Text { get; }
    Property Value
    Type Description
    System.String

    Url

    Gets the URI if the Value is a valid URI.

    Declaration
    public Uri Url { get; }
    Property Value
    Type Description
    System.Uri

    Value

    The value of the barcode as a string.

    Declaration
    public string Value { get; }
    Property Value
    Type Description
    System.String

    Width

    A Barcode Width

    Declaration
    public Nullable<int> Width { get; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Methods

    ToString()

    Returns a System.String that represents the value of the barcode as a string;

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents this instance.

    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronBarcode_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronBarcode