IRONSOFTWAREHOME

C# Barcode Scanner: Read Barcodes & QR Codes in .NET Applications

Jacob Mellor, Chief Technology Officer @ Team Iron
Jacob Mellor
Updated: August 2, 2026

Need to quickly scan barcodes or QR codes in your .NET application? IronBarcode makes barcode reading simple and reliable, whether you're processing perfect digital images or challenging real-world photos. This guide shows you exactly how to implement barcode scanning in C# with practical examples you can use immediately.

Quickstart: Read a Barcode from a File Instantly

This quick example shows you how easy it is to get started with IronBarcode. In just one line of code, you can read barcodes from an image file - no complex setup required.

  1. 1Install IronBarcode with NuGet Package Manager

    PM > Install-Package BarCode

  2. 2Copy and run this code snippet.

    var results = IronBarCode.BarcodeReader.Read("path/to/barcode.png");
    C#
  3. 3Deploy to test on your live environment

    Start using IronBarcode in your project today with a free trial
    arrow pointer

How do I install IronBarcode in my .NET project?

IronBarcode installs easily through NuGet Package Manager or by downloading the DLL directly. The NuGet installation is the recommended approach as it automatically manages dependencies and updates.

PM > Install-Package BarCode

After installation, add using IronBarCode; to your C# files to access the barcode scanning functionality. For detailed installation instructions across different development environments, check our installation guide.

How can I read my first barcode using C#?

Reading barcodes with IronBarcode requires just one line of code. The library automatically detects barcode formats and extracts all encoded data.

Code128 barcode ready for scanning - contains text 'https://ironsoftware.com/csharp/barcode/'A standard Code128 barcode that IronBarcode can read instantly
using IronBarCode;

BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Choose which filters are to be applied (in order)
    ImageFilters = new ImageFilterCollection() {
        new AdaptiveThresholdFilter(),
    },

    // Uses machine learning to auto rotate the barcode
    AutoRotate = true,
};

// Read barcode
BarcodeResults results = BarcodeReader.Read("TryHarderQR.png", options);

The BarcodeReader.Read method returns a BarcodeResults collection containing all detected barcodes. Each BarcodeResult provides access to the barcode's text value, format type, position coordinates, and binary data. This approach works seamlessly with common barcode formats including Code128, Code39, QR codes, and Data Matrix codes.

What options help read challenging or damaged barcodes?

Real-world barcode scanning often involves imperfect images - skewed angles, poor lighting, or partial damage. IronBarcode's advanced options handle these challenges effectively.

using IronBarCode;
using System;

// Multiple barcodes may be scanned up from a single document or image. A PDF document may also used as the input image
BarcodeResults results = BarcodeReader.ReadPdf("MultipleBarcodes.pdf");

// Work with the results
foreach (var pageResult in results)
{
    string Value = pageResult.Value;
    int PageNum = pageResult.PageNumber;
    System.Drawing.Bitmap Img = pageResult.BarcodeImage;
    BarcodeEncoding BarcodeType = pageResult.BarcodeType;
    byte[] Binary = pageResult.BinaryValue;
    Console.WriteLine(pageResult.Value + " on page " + PageNum);
}
QR code rotated 45 degrees demonstrating IronBarcode's rotation handlingA rotated QR code that IronBarcode successfully reads using advanced options

The ExpectBarcodeTypes property significantly improves performance by limiting the search to specific formats. For maximum accuracy with problematic images, combine image filters with automatic rotation:

using IronBarCode;

// Multi frame TIFF and GIF images can also be scanned
BarcodeResults multiFrameResults = BarcodeReader.Read("Multiframe.tiff");

foreach (var pageResult in multiFrameResults)
{
    //...
}

These advanced features make IronBarcode ideal for scanning barcodes from photos, security cameras, or mobile device captures where image quality varies significantly.

How do I scan multiple barcodes from PDF documents?

PDF barcode scanning is essential for processing invoices, shipping labels, and inventory documents. IronBarcode reads all barcodes across every page efficiently.

Reading barcodes from PDF files

using IronBarCode;

// The Multithreaded property allows for faster barcode scanning across multiple images or PDFs. All threads are automatically managed by IronBarCode.
var ListOfDocuments = new[] { "image1.png", "image2.JPG", "image3.pdf" };

BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Enable multithreading
    Multithreaded = true,
};

BarcodeResults batchResults = BarcodeReader.Read(ListOfDocuments, options);

Multiple barcodes detected across PDF pages showing console output Console output showing multiple barcodes found across different PDF pages

For specific page ranges or advanced PDF processing, use BarcodeReaderOptions:

// Read only specific pages to improve performance
PdfBarcodeReaderOptions pdfOptions = new PdfBarcodeReaderOptions
{
    // Scan pages 1-5 only
    PageNumbers = new[] { 1, 2, 3, 4, 5 },

    // PDF-specific settings
    DPI = 300 // Higher DPI for better accuracy
};

BarcodeResults results = BarcodeReader.ReadPdf("document.pdf", pdfOptions);
C#

How can I process multiframe TIFF images?

Multiframe TIFF files, common in document scanning and fax systems, receive the same comprehensive support as PDFs.

Multiframe TIFF containing multiple barcodes across frames A multiframe TIFF file with barcodes on different frames

using IronBarCode;

// TIFF files are processed similarly to regular images
// Each frame is scanned automatically
BarcodeResults multiFrameResults = BarcodeReader.Read("Multiframe.tiff");

foreach (var result in multiFrameResults)
{
    // Access frame-specific information
    int frameNumber = result.PageNumber; // Frame number in TIFF
    string barcodeValue = result.Text;
    
    Console.WriteLine($"Frame {frameNumber}: {barcodeValue}");
    
    // Save individual barcode images if needed
    result.BarcodeImage?.Save($"barcode_frame_{frameNumber}.png");
}

The same BarcodeReaderOptions apply to TIFF processing, including image filters and rotation settings. For detailed TIFF handling scenarios, see our image processing tutorials.

Can I speed up processing with multithreading?

Processing multiple documents benefits dramatically from parallel processing. IronBarcode automatically utilizes available CPU cores for optimal performance.

using IronBarCode;

// List of documents to process - mix of formats supported
var documentBatch = new[] 
{ 
    "invoice1.pdf", 
    "shipping_label.png", 
    "inventory_sheet.tiff",
    "product_catalog.pdf"
};

// Configure for batch processing
BarcodeReaderOptions batchOptions = new BarcodeReaderOptions
{
    // Enable parallel processing across documents
    Multithreaded = true,
    
    // Limit threads if needed (0 = use all cores)
    MaxParallelThreads = Environment.ProcessorCount,
    
    // Apply consistent settings to all documents
    Speed = ReadingSpeed.Balanced,
    ExpectBarcodeTypes = BarcodeEncoding.All
};

// Process each document, tracking the source path externally
foreach (var document in documentBatch)
{
    BarcodeResults results = BarcodeReader.Read(document, batchOptions);

    Console.WriteLine($"\nDocument: {document}");
    foreach (var barcode in results)
    {
        Console.WriteLine($"  - {barcode.BarcodeType}: {barcode.Text}");
    }
}
C#

This parallel approach processes documents simultaneously, reducing total scanning time on multicore systems. For enterprise-scale barcode processing, explore our performance optimization guide.

Summary

IronBarcode transforms complex barcode scanning into straightforward C# code. Whether you're building inventory systems, document processors, or mobile applications, the library handles everything from pristine digital barcodes to challenging real-world captures.

Key capabilities covered:

  • Single-line barcode reading from images
  • Advanced options for damaged or rotated barcodes
  • Comprehensive PDF and TIFF document scanning
  • High-performance batch processing with multithreading
  • Support for all major barcode formats

Further Reading

Expand your barcode processing capabilities with these resources:

Source Code Downloads

Run these examples yourself:

Ready to implement barcode scanning in your application? Start your free trial and add professional barcode reading to your .NET project today.

First Step:
arrow pointer

Frequently Asked Questions

What is IronBarcode?

IronBarcode is a .NET library that simplifies reading barcodes and QR codes in C# by providing easy-to-use functions and advanced features to handle various image quality levels.

How do I read barcodes in C# using IronBarcode?

You can read barcodes in C# using IronBarcode with a single line of code: `IronBarCode.BarcodeReader.Read("path/to/barcode.png");`. This method efficiently detects the barcode type and provides the encoded information.

Can IronBarcode read multiple barcodes from a single file?

Yes, IronBarcode supports reading multiple barcodes from a single image or document, including PDFs and multiframe TIFF files, by automatically detecting and extracting each barcode.

What features does IronBarcode offer for handling damaged barcodes?

IronBarcode offers advanced features like automatic rotation, image filtering with `AdaptiveThresholdFilter`, and machine learning to decode barcodes from imperfect images, such as those with poor lighting or skewed angles.

How can I install IronBarcode in my .NET project?

You can easily install IronBarcode in your .NET project via the NuGet Package Manager or by downloading the DLL files. It is recommended to use NuGet for automatic dependency management and updates.

Does IronBarcode support barcode scanning from PDF documents?

Yes, IronBarcode efficiently scans barcodes from PDF documents across all pages and supports multithreading for faster processing.

Can IronBarcode handle multiframe TIFF images?

Yes, IronBarcode can process multiframe TIFF images, automatically scanning each frame for barcodes and providing comprehensive results.

How does IronBarcode optimize barcode scanning performance?

IronBarcode optimizes performance with multithreading capabilities, allowing barcode scanning across multiple documents and images using all available CPU cores for reduced processing time.

What barcode formats are supported by IronBarcode?

IronBarcode supports a wide range of barcode formats, including Code128, Code39, QR codes, Data Matrix codes, and more, allowing versatile application in various scenarios.

Is there a way to improve barcode reading accuracy in IronBarcode?

Improving accuracy in IronBarcode can be achieved by configuring `BarcodeReaderOptions` to use specific image filters, enabling automatic rotation, and setting the `ExpectBarcodeTypes` property to restrict scanning to certain barcode types.

Jacob Mellor, Chief Technology Officer @ Team Iron
Chief Technology Officer

Jacob Mellor is Chief Technology Officer at Iron Software and a visionary engineer pioneering C# PDF technology. As the original developer behind Iron Software's core codebase, he has shaped the company's product architecture since its inception, transforming it alongside CEO Cameron Rimington into a 50+ person company serving NASA, Tesla, and global government agencies.

...
Read More

Ready to Get Started?

Nuget Downloads 2,422,100Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package BarCode
nuget.org/packages/BarCode/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronBarCode"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronBarCode to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronBarCode.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required