Przejdź do treści stopki
KORZYSTANIE Z IRONBARCODE

Zbuduj SDK do kodów kreskowych C#: Generuj, odczytuj i skanuj kody kreskowe za pomocą jednej biblioteki

Most barcode SDK C# projects start with the same headache: stitching together separate libraries for generation, reading, and export, then wrestling with compatibility across barcode types and platforms. IronBarcode eliminates that friction entirely. It's a single .NET library that handles every barcode operation developers typically need from a dedicated barcode scanner SDK, from creating linear barcodes and QR codes to scanning multiple barcodes from imperfect images and PDF files.

In this article, we'll walk you through the core capabilities that make IronBarcode an all-in-one solution for barcode SDK projects: generating barcode images, reading barcode data from files, and configuring advanced scan settings for production-quality accuracy. Every following code example runs as-is in a .NET console app.

NuGet Zainstaluj za pomocą NuGet

PM >  Install-Package BarCode

Sprawdź IronBarcode na NuGet dla szybkiej instalacji. Z ponad 10 milionami pobrań, przekształca rozwój PDF z C#. Możesz również pobrać DLL.

What Should a Barcode SDK Handle in .NET Projects?

A capable barcode scanner SDK needs to cover three essential operations: generating barcodes, reading barcode data from images and documents, and handling real-world scan quality issues. The best barcode reader SDK options also support a wide range of symbologies without requiring separate libraries for each one.

IronBarcode supports both linear barcodes (Code 128, Code 39, UPC-A, UPC-E, EAN-8, EAN-13, GS1 DataBar) and 2D barcodes (QR Code, Data Matrix, PDF417, Aztec, MaxiCode). This coverage means .NET developers can process everything from retail UPC-A labels to warehouse QR codes using a single barcode DLL, no additional dependencies, no platform-specific native binaries. A free trial license gives full access to every feature for 30 days.

The library runs across Windows, macOS, and Linux operating systems, with support for .NET MAUI and Android app deployments. It also integrates with reporting tools like Crystal Reports for scenarios that demand embedded barcode generation inside business documents. Whether the project is a console app, a .NET MAUI mobile scanner, or a server-side barcode reader processing thousands of images, the same barcode scanner SDK API handles it all.

How Can Developers Generate Barcode Images in C#?

The BarcodeWriter.CreateBarcode method generates a barcode image from a string value and a specified symbology in a single call. The returned GeneratedBarcode object can be saved as a PNG, BMP, JPEG, PDF, HTML file, or exported in vector formats like SVG.

using IronBarCode;
// Generate a Code 128 barcode image from string data
var barcode = BarcodeWriter.CreateBarcode("PKG-2025-88421", BarcodeEncoding.Code128);
barcode.AddAnnotationTextAboveBarcode("Shipping Label");
barcode.AddBarcodeValueTextBelowBarcode();
barcode.ResizeTo(500, 150);
barcode.SaveAsPng("shipping-label.png");
// Create a styled QR code with a logo
var qrCode = QRCodeWriter.CreateQrCode("https://example.com/track/88421", 300);
qrCode.ChangeBarCodeColor(IronSoftware.Drawing.Color.DarkSlateGray);
qrCode.SaveAsPng("tracking-qr.png");
using IronBarCode;
// Generate a Code 128 barcode image from string data
var barcode = BarcodeWriter.CreateBarcode("PKG-2025-88421", BarcodeEncoding.Code128);
barcode.AddAnnotationTextAboveBarcode("Shipping Label");
barcode.AddBarcodeValueTextBelowBarcode();
barcode.ResizeTo(500, 150);
barcode.SaveAsPng("shipping-label.png");
// Create a styled QR code with a logo
var qrCode = QRCodeWriter.CreateQrCode("https://example.com/track/88421", 300);
qrCode.ChangeBarCodeColor(IronSoftware.Drawing.Color.DarkSlateGray);
qrCode.SaveAsPng("tracking-qr.png");
Imports IronBarCode

' Generate a Code 128 barcode image from string data
Dim barcode = BarcodeWriter.CreateBarcode("PKG-2025-88421", BarcodeEncoding.Code128)
barcode.AddAnnotationTextAboveBarcode("Shipping Label")
barcode.AddBarcodeValueTextBelowBarcode()
barcode.ResizeTo(500, 150)
barcode.SaveAsPng("shipping-label.png")

' Create a styled QR code with a logo
Dim qrCode = QRCodeWriter.CreateQrCode("https://example.com/track/88421", 300)
qrCode.ChangeBarCodeColor(IronSoftware.Drawing.Color.DarkSlateGray)
qrCode.SaveAsPng("tracking-qr.png")
$vbLabelText   $csharpLabel

Generated Barcode Images

Build a Barcode SDK C#: Generate, Read, and Scan Barcodes with One Library: Image 1 - Output barcode and QR code images

The BarcodeWriter class accepts data as a string, byte array, or stream, giving flexibility for different data sources. The BarcodeEncoding enum controls the symbology, pass BarcodeEncoding.QRCode for a QR code, BarcodeEncoding.UPCA for UPC-A retail labels, or any of the supported barcode formats. For styled QR codes, the dedicated QRCodeWriter class supports error correction levels and logo embedding, making it simple to create branded codes.

The GeneratedBarcode object also provides methods to customize barcode properties like margins, colors, and annotation text. Barcode images can be exported in raster image formats (PNG, BMP, JPEG) and vector formats, or rendered directly to HTML for web app scenarios. See the barcode creation examples for additional output options.

How Does the Barcode Reader Work Across Image and PDF Files?

The BarcodeReader.Read method accepts an image file path, byte array, bitmap, or stream and returns a BarcodeResults collection containing every barcode found in the input. Each BarcodeResult exposes the barcode value, encoding type, page number, binary data, and the barcode image region.

using IronBarCode;
// Use the barcode reader to decode all barcodes from an image file
var results = BarcodeReader.Read("multiple-barcodes.png");
foreach (var result in results)
{
    Console.WriteLine($"Type: {result.BarcodeType} | Value: {result.Value}");
}
// The barcode reader also scans multi-page PDF documents
var pdfResults = BarcodeReader.ReadPdf("invoice-batch.pdf");
foreach (var item in pdfResults)
{
    Console.WriteLine($"Page {item.PageNumber}: {item.Value}");
}
using IronBarCode;
// Use the barcode reader to decode all barcodes from an image file
var results = BarcodeReader.Read("multiple-barcodes.png");
foreach (var result in results)
{
    Console.WriteLine($"Type: {result.BarcodeType} | Value: {result.Value}");
}
// The barcode reader also scans multi-page PDF documents
var pdfResults = BarcodeReader.ReadPdf("invoice-batch.pdf");
foreach (var item in pdfResults)
{
    Console.WriteLine($"Page {item.PageNumber}: {item.Value}");
}
Imports IronBarCode

' Use the barcode reader to decode all barcodes from an image file
Dim results = BarcodeReader.Read("multiple-barcodes.png")
For Each result In results
    Console.WriteLine($"Type: {result.BarcodeType} | Value: {result.Value}")
Next

' The barcode reader also scans multi-page PDF documents
Dim pdfResults = BarcodeReader.ReadPdf("invoice-batch.pdf")
For Each item In pdfResults
    Console.WriteLine($"Page {item.PageNumber}: {item.Value}")
Next
$vbLabelText   $csharpLabel

Reading Barcodes Output

Build a Barcode SDK C#: Generate, Read, and Scan Barcodes with One Library: Image 2 - Read barcode data output

The barcode reader performs barcode recognition across all major symbologies by default, automatically detecting linear barcodes, 2D barcodes, and QR codes without requiring the developer to specify which type to scan for. When scanning a PDF, ReadPdf processes every page and returns results with page numbers attached, ideal for document indexing and archival workflows.

Each BarcodeResult in the collection provides access to the decoded barcode data as both a string and a byte array. This is particularly useful when processing Data Matrix codes or other symbologies that encode binary data. The barcode reader result also includes the barcode's position coordinates, enabling applications to map where each code appeared in the source image file. For batch processing across an entire folder of images, pass an IEnumerable<string> of file paths to the barcode reader with multithreading enabled for parallel execution.

How Can a Barcode Scanner SDK Handle Real-World Image Quality?

Real-world barcode images, from warehouse cameras, mobile captures, or scanned documents, are rarely pixel-perfect. The BarcodeReaderOptions class provides granular control over scan speed, expected symbologies, image correction filters, and multithreaded batch processing to achieve highly accurate barcode recognition even on damaged or skewed input.

using IronBarCode;
// Configure the barcode reader for challenging, real-world image quality
var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Detailed,
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional | BarcodeEncoding.QRCode,
    Multithreaded = true,
    MaxParallelThreads = 4,
    ImageFilters = new ImageFilterCollection
    {
        new SharpenFilter(),
        new ContrastFilter()
    }
};
// Scan multiple barcodes from a noisy image with high accuracy
var results = BarcodeReader.Read("camera-capture.jpg", options);
foreach (var barcode in results)
{
    Console.WriteLine($"Detected: {barcode.BarcodeType} &mdash; {barcode.Value}");
}
using IronBarCode;
// Configure the barcode reader for challenging, real-world image quality
var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Detailed,
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional | BarcodeEncoding.QRCode,
    Multithreaded = true,
    MaxParallelThreads = 4,
    ImageFilters = new ImageFilterCollection
    {
        new SharpenFilter(),
        new ContrastFilter()
    }
};
// Scan multiple barcodes from a noisy image with high accuracy
var results = BarcodeReader.Read("camera-capture.jpg", options);
foreach (var barcode in results)
{
    Console.WriteLine($"Detected: {barcode.BarcodeType} &mdash; {barcode.Value}");
}
Imports IronBarCode

' Configure the barcode reader for challenging, real-world image quality
Dim options As New BarcodeReaderOptions With {
    .Speed = ReadingSpeed.Detailed,
    .ExpectMultipleBarcodes = True,
    .ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional Or BarcodeEncoding.QRCode,
    .Multithreaded = True,
    .MaxParallelThreads = 4,
    .ImageFilters = New ImageFilterCollection From {
        New SharpenFilter(),
        New ContrastFilter()
    }
}

' Scan multiple barcodes from a noisy image with high accuracy
Dim results = BarcodeReader.Read("camera-capture.jpg", options)
For Each barcode In results
    Console.WriteLine($"Detected: {barcode.BarcodeType} — {barcode.Value}")
Next
$vbLabelText   $csharpLabel

Output for Noisy Barcode Image Scan

Build a Barcode SDK C#: Generate, Read, and Scan Barcodes with One Library: Image 3 - Example output for scanning a noisy barcode image

Setting ExpectBarcodeTypes to a specific subset of symbologies (rather than scanning for all types) dramatically improves both speed and accuracy. The ReadingSpeed enum offers four tiers — Faster, Balanced, Detailed, and ExtremeDetail, letting developers tune the tradeoff between processing time and barcode recognition thoroughness. The ImageFilterCollection applies preprocessing filters like sharpening, contrast adjustment, and adaptive thresholding before the scan engine processes the barcode image.

The ExpectMultipleBarcodes flag tells the engine to continue scanning after finding the first match, which is essential when you need to scan multiple barcodes on a single label or document page. Combined with Multithreaded = true, the library distributes batch processing across CPU cores for high-throughput scanning scenarios. For a deeper dive into these settings, the reading barcodes tutorial covers every configuration option with sample code.

What Barcode Types and Platforms Are Supported?

IronBarcode covers the most widely-used barcode symbologies across retail, logistics, healthcare, and enterprise applications. The following table summarizes the supported barcode types and target platforms.

Category Supported Formats
Linear Barcodes Code 128, Code 39, Code 93, UPC-A, UPC-E, EAN-8, EAN-13, GS1 DataBar, ITF, MSI, Codabar
2D Barcodes QR Code, Data Matrix, PDF417, Aztec, MaxiCode
Image Formats PNG, JPEG, BMP, GIF, TIFF, SVG
Document Formats PDF (multi-page), HTML
.NET Platforms .NET 8/7/6, .NET Core, .NET Framework 4.6.2+, .NET Standard 2.0+
App Types Console, Windows Forms, WPF, ASP.NET, .NET MAUI, Blazor
Operating Systems Windows, macOS, Linux, Android (via .NET MAUI)

The library installs as a single NuGet package (BarCode) or as a standalone barcode DLL via direct download. No native SDK dependencies are required, the entire barcode scanner SDK ships as managed .NET code. Install it in Visual Studio through the NuGet Package Manager, or run dotnet add package BarCode from the CLI. For deployment scenarios that require DLL-level control, the IronBarcode DLL download provides a ZIP package ready for manual integration.

IronBarcode also supports Crystal Reports integration and other reporting tools where embedded barcode generation is needed. For .NET MAUI and Android app development, the barcode scanner SDK provides cross-platform barcode reading without requiring platform-specific camera SDKs — just pass an image file captured by the device's camera to the barcode reader. The .NET MAUI barcode scanner tutorial covers this .NET MAUI workflow in detail, including Android permissions and sample code for mobile scanning.

Where to Go from Here

IronBarcode gives .NET developers a complete barcode library for SDK-level projects with generation, reading, batch scanning, and export all included - without the complexity of managing multiple packages. The latest version adds ML-powered image preprocessing and the ReadPdfs method for batch PDF processing, continuing to push what a single library can do.

Start a free trial to test every feature in your own project with no watermarks or restrictions. When you're ready for production, explore IronBarcode licensing options starting at $799 for individual developers — with free support from Iron Software's engineering team included.

Zacznij z IronBarcode teraz.
green arrow pointer

Często Zadawane Pytania

Do czego służy IronBarcode w projektach C#?

IronBarcode to biblioteka .NET, która upraszcza operacje związane z kodami kreskowymi, umożliwiając programistom generowanie, odczytywanie i skanowanie różnych typów kodów kreskowych w projektach C#, eliminując potrzebę używania wielu bibliotek.

Czy IronBarcode obsługuje różne typy kodów kreskowych?

Tak, IronBarcode obsługuje szeroką gamę typów kodów kreskowych, w tym liniowe kody kreskowe i kody QR, zapewniając kompatybilność z różnymi aplikacjami.

Jak IronBarcode poprawia skanowanie kodów kreskowych w C#?

IronBarcode ulepsza skanowanie kodów kreskowych, oferując solidną funkcjonalność do skanowania wielu kodów kreskowych z niedoskonałych obrazów i plików PDF, zwiększając dokładność i wydajność.

Czy dostępny jest przykładowy kod do użycia z IronBarcode?

Tak, dołączony jest przykładowy kod, aby pomóc programistom szybko zintegrować funkcjonalności generowania i skanowania kodów kreskowych w swoich projektach C# z wykorzystaniem IronBarcode.

Dlaczego wybrać IronBarcode zamiast oddzielnych bibliotek do operacji na kodach kreskowych?

IronBarcode łączy operacje generowania, odczytywania i skanowania kodów kreskowych w jedną bibliotekę, zmniejszając złożoność i problemy z kompatybilnością związane z używaniem wielu bibliotek.

Jordi Bardia
Inżynier oprogramowania
Jordi jest najbardziej biegły w Pythonie, C# i C++. Kiedy nie wykorzystuje swoich umiejętności w Iron Software, programuje gry. Dzieląc odpowiedzialność za testowanie produktów, rozwój produktów i badania, Jordi wnosi ogromną wartość do ciągłej poprawy produktów. Różnorodne doświadczenia ...
Czytaj więcej

Zespol wsparcia Iron

Jestesmy online 24 godziny, 5 dni w tygodniu.
Czat
Email
Zadzwon do mnie