Skip to footer content
USING IRONBARCODE

How to Generate QR Codes in C# with IronBarcode

IronBarcode enables .NET developers to create QR codes efficiently using its QRCodeWriter class. It supports custom logos, colors, multiple output formats, and cross-platform deployment, including Windows, Linux, macOS, and mobile.

This guide demonstrates how to use IronBarcode to generate QR codes for production systems. IronBarcode's API adheres to .NET conventions while providing the performance and reliability needed for enterprise applications. The library offers complete documentation and supports deployment across Windows, Linux, macOS, and mobile platforms. For a complete overview of all capabilities, explore the features page. The barcode quickstart guide provides immediate hands-on examples to get you started.

What Are the Benefits of Using IronBarcode for QR Code Generation?

Why Choose IronBarcode Over Other Libraries?

How Do I Generate QR Codes with IronBarcode?

The following sections demonstrate production-ready code following SOLID principles. You'll learn to create various QR code types, implement custom styling, and ensure reliable scanning performance. The library's features include support for 1D and 2D barcodes beyond QR codes. For advanced scenarios, review the API reference for complete method signatures. Explore the demos to see IronBarcode's capabilities in action.

How Do I Set Up a New Project?

Open Visual Studio and select New Project from the File Menu. For enterprise deployments, consider reviewing the MSI installer guide for automated installations. The get started overview provides complete setup instructions.

Choose the Console App template and click Next.

Enter your preferred project name (like QR Code Generator) and specify the location. Click Next.

Select a .NET Framework from the dropdown (.NET 6.0 (Long term support)) and click Create. IronBarcode supports all modern .NET versions as detailed in the compatibility documentation. For specific platform requirements, check the guide for Blazor integration.

What Installation Methods Are Available?

Install IronBarcode using one of four methods suited to different workflows. The library's live demos demonstrate real-time barcode recognition capabilities. For quick testing, explore the barcode quickstart example.

How Do I Install Using Visual Studio's Package Manager UI?

Go to Tools > NuGet Package Manager > Manage NuGet Packages for solution...

Or right-click your project in Solution Explorer and select Manage NuGet Packages...

Click Browse, search Barcode, select IronBarcode, choose your project, and click Install. For platform-specific installations, see the NuGet packages guide. If you encounter issues, consult the NuGet troubleshooting guide. The library supports various deployment scenarios including AWS Lambda and Azure Functions.

How Do I Install Using Package Manager Console?

Open Tools > NuGet Package Manager > Package Manager Console and run:

Install-Package BarCode

This installs the library into your current project. For containerized deployments, follow the Docker setup guide. When using license keys, ensure proper configuration for your deployment environment.

How Do I Download from NuGet or IronBarcode Website?

Download from the NuGet Gallery website or visit IronBarcode's homepage to get the latest .NET barcode DLL. Add the DLL to your project via Add > Reference in Solution Explorer. For troubleshooting DLL issues, see the missing DLL guide. When encountering runtime issues, consult the runtime copy exception guide.

How Do I Create and Customize QR Code Images?

How Do I Generate a Basic QR Code?

Create QR codes using the CreateQrCode method from the QRCodeWriter class. For a complete example, see the C# QR code generator tutorial. The library supports creating barcode images in various formats:

using IronBarCode;

// Basic QR code generation with medium error correction
var qrCode = QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium, 0);
qrCode.SaveAsPng("MyQR.png");

// Generate QR code with automatic sizing and highest error correction
var autoQr = QRCodeWriter.CreateQrCode("Automatic sizing example");
autoQr.SaveAsJpeg("AutoQR.jpg");

// Production-ready QR code with validation
public GeneratedBarcode CreateValidatedQrCode(string data, int size = 600)
{
    if (string.IsNullOrWhiteSpace(data))
        throw new ArgumentException("Data cannot be empty");

    if (data.Length > 2953) // QR Code capacity at highest error correction
        throw new ArgumentException("Data exceeds QR code capacity");

    var qr = QRCodeWriter.CreateQrCode(data, size, QRCodeWriter.QrErrorCorrectionLevel.High);
    qr.VerifyQrCode(); // Verify the generated code is valid
    return qr;
}
using IronBarCode;

// Basic QR code generation with medium error correction
var qrCode = QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium, 0);
qrCode.SaveAsPng("MyQR.png");

// Generate QR code with automatic sizing and highest error correction
var autoQr = QRCodeWriter.CreateQrCode("Automatic sizing example");
autoQr.SaveAsJpeg("AutoQR.jpg");

// Production-ready QR code with validation
public GeneratedBarcode CreateValidatedQrCode(string data, int size = 600)
{
    if (string.IsNullOrWhiteSpace(data))
        throw new ArgumentException("Data cannot be empty");

    if (data.Length > 2953) // QR Code capacity at highest error correction
        throw new ArgumentException("Data exceeds QR code capacity");

    var qr = QRCodeWriter.CreateQrCode(data, size, QRCodeWriter.QrErrorCorrectionLevel.High);
    qr.VerifyQrCode(); // Verify the generated code is valid
    return qr;
}
$vbLabelText   $csharpLabel

The CreateQrCode method accepts:

  • Required: data to encode (String or Stream)
  • Optional: graphic dimensions (default 500x500px)
  • Optional: error correction level (Low 7%, Medium 15%, High 25%, Highest 30%)
  • Optional: QR version number (0 for automatic)

For high-performance batch processing, use async operations and custom styling. When working with imperfect conditions, use the fault tolerance features. The reading barcodes tutorial demonstrates how to verify generated codes.

What Data Types Can I Encode in QR Codes?

Common QR code data types for production applications include creating barcodes from various sources. For detailed examples, see the create QR code example. IronBarcode supports Unicode barcodes for international character encoding:

URL QR Codes:

// Generate QR code for website URL
var urlQr = QRCodeWriter.CreateQrCode("___PROTECTED_URL_76___", 800);
urlQr.SetMargins(10); // Add quiet zone
urlQr.SaveAsPng("campaign-qr.png");

// Advanced URL QR code with tracking
public GeneratedBarcode CreateTrackableUrlQr(string baseUrl, Dictionary<string, string> utmParams)
{
    var uriBuilder = new UriBuilder(baseUrl);
    var query = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);

    foreach (var param in utmParams)
        query[param.Key] = param.Value;

    uriBuilder.Query = query.ToString();
    var qr = QRCodeWriter.CreateQrCode(uriBuilder.ToString(), 1000);
    return qr;
}
// Generate QR code for website URL
var urlQr = QRCodeWriter.CreateQrCode("___PROTECTED_URL_76___", 800);
urlQr.SetMargins(10); // Add quiet zone
urlQr.SaveAsPng("campaign-qr.png");

// Advanced URL QR code with tracking
public GeneratedBarcode CreateTrackableUrlQr(string baseUrl, Dictionary<string, string> utmParams)
{
    var uriBuilder = new UriBuilder(baseUrl);
    var query = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);

    foreach (var param in utmParams)
        query[param.Key] = param.Value;

    uriBuilder.Query = query.ToString();
    var qr = QRCodeWriter.CreateQrCode(uriBuilder.ToString(), 1000);
    return qr;
}
$vbLabelText   $csharpLabel

vCard Contact Information:

string vCard = @"BEGIN:VCARD
VERSION:3.0
FN:John Smith
ORG:Tech Corp
TEL:+1-555-0123
EMAIL:john@example.com
END:VCARD";

var contactQr = QRCodeWriter.CreateQrCode(vCard, 600, QRCodeWriter.QrErrorCorrectionLevel.Medium);
contactQr.SaveAsPng("contact-card.png");
string vCard = @"BEGIN:VCARD
VERSION:3.0
FN:John Smith
ORG:Tech Corp
TEL:+1-555-0123
EMAIL:john@example.com
END:VCARD";

var contactQr = QRCodeWriter.CreateQrCode(vCard, 600, QRCodeWriter.QrErrorCorrectionLevel.Medium);
contactQr.SaveAsPng("contact-card.png");
$vbLabelText   $csharpLabel

WiFi Configuration:

string wifiConfig = "WIFI:T:WPA;S:NetworkName;P:Password123;;";
var wifiQr = QRCodeWriter.CreateQrCode(wifiConfig, 500);
wifiQr.SaveAsPng("wifi-config.png");
string wifiConfig = "WIFI:T:WPA;S:NetworkName;P:Password123;;";
var wifiQr = QRCodeWriter.CreateQrCode(wifiConfig, 500);
wifiQr.SaveAsPng("wifi-config.png");
$vbLabelText   $csharpLabel

IronBarcode handles Unicode support for international characters and supports formats like Micro QR and rMQR for space-constrained applications. For specialized formats, explore the new formats milestone. When working with specialized data formats, the library can read from streams and export as streams for efficient memory usage.

How Do I Add Logos and Custom Styling?

Use CreateQrCodeWithLogo to add company logos to QR codes. For complete styling options, see the custom QR code example and QR code styling guide. The library also supports general barcode styling for all barcode types:

// Create QR code with embedded logo
var qrWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World", "logo.png", 500);
qrWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkRed);
qrWithLogo.SaveAsPng("Logo_QR_Code.png");

// Advanced logo customization
var logo = new QRCodeLogo("company-logo.png")
{
    Width = 100,
    Height = 100,
    CornerRadius = 5
};
var advancedQr = QRCodeWriter.CreateQrCodeWithLogo("Advanced Example", logo, 600);

// Production-ready branded QR code
public GeneratedBarcode CreateBrandedQrCode(string data, string logoPath, string brandColor)
{
    var logo = new QRCodeLogo(logoPath)
    {
        Width = 80,
        Height = 80,
        CornerRadius = 10
    };

    var qr = QRCodeWriter.CreateQrCodeWithLogo(data, logo, 800);
    qr.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml(brandColor));
    qr.SetMargins(15);
    return qr;
}
// Create QR code with embedded logo
var qrWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World", "logo.png", 500);
qrWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkRed);
qrWithLogo.SaveAsPng("Logo_QR_Code.png");

// Advanced logo customization
var logo = new QRCodeLogo("company-logo.png")
{
    Width = 100,
    Height = 100,
    CornerRadius = 5
};
var advancedQr = QRCodeWriter.CreateQrCodeWithLogo("Advanced Example", logo, 600);

// Production-ready branded QR code
public GeneratedBarcode CreateBrandedQrCode(string data, string logoPath, string brandColor)
{
    var logo = new QRCodeLogo(logoPath)
    {
        Width = 80,
        Height = 80,
        CornerRadius = 10
    };

    var qr = QRCodeWriter.CreateQrCodeWithLogo(data, logo, 800);
    qr.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml(brandColor));
    qr.SetMargins(15);
    return qr;
}
$vbLabelText   $csharpLabel

Apply additional styling with barcode customization features. The styling barcodes feature provides complete customization options:

// Use HTML color codes for brand colors
qrWithLogo.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml("#8B0000"));
qrWithLogo.ChangeBackgroundColor(System.Drawing.Color.LightGray);
qrWithLogo.AddAnnotationTextAboveBarcode("SCAN ME");
qrWithLogo.AddAnnotationTextBelowBarcode("Company Name");
// Use HTML color codes for brand colors
qrWithLogo.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml("#8B0000"));
qrWithLogo.ChangeBackgroundColor(System.Drawing.Color.LightGray);
qrWithLogo.AddAnnotationTextAboveBarcode("SCAN ME");
qrWithLogo.AddAnnotationTextBelowBarcode("Company Name");
$vbLabelText   $csharpLabel

What Export Formats Are Available?

Save QR codes in various formats for different use cases. Learn more in the save barcode example and barcode image generator tutorial. For specialized requirements, see the guide on creating 1-BPP barcode images:

// Image formats
qrWithLogo.SaveAsJpeg("qr.jpg");
qrWithLogo.SaveAsPng("qr.png");
qrWithLogo.SaveAsGif("qr.gif");
qrWithLogo.SaveAsTiff("qr.tiff");

// Web formats
qrWithLogo.SaveAsHtmlFile("qr.html");
string dataUrl = qrWithLogo.ToDataUrl();

// Print formats
qrWithLogo.SaveAsPdf("qr.pdf");
qrWithLogo.ChangeBarcodeDpi(300);

// API formats
byte[] qrBytes = qrWithLogo.ToPngBinaryData();
var stream = qrWithLogo.ToStream();

// High-quality print export
public void ExportForPrint(GeneratedBarcode qr, string filename)
{
    qr.ChangeBarcodeDpi(600); // High DPI for print
    qr.ResizeTo(2000, 2000); // Large size
    qr.SaveAsTiff(filename); // Lossless format
}
// Image formats
qrWithLogo.SaveAsJpeg("qr.jpg");
qrWithLogo.SaveAsPng("qr.png");
qrWithLogo.SaveAsGif("qr.gif");
qrWithLogo.SaveAsTiff("qr.tiff");

// Web formats
qrWithLogo.SaveAsHtmlFile("qr.html");
string dataUrl = qrWithLogo.ToDataUrl();

// Print formats
qrWithLogo.SaveAsPdf("qr.pdf");
qrWithLogo.ChangeBarcodeDpi(300);

// API formats
byte[] qrBytes = qrWithLogo.ToPngBinaryData();
var stream = qrWithLogo.ToStream();

// High-quality print export
public void ExportForPrint(GeneratedBarcode qr, string filename)
{
    qr.ChangeBarcodeDpi(600); // High DPI for print
    qr.ResizeTo(2000, 2000); // Large size
    qr.SaveAsTiff(filename); // Lossless format
}
$vbLabelText   $csharpLabel

For PDF-specific operations, see the guides on creating barcodes as PDF and stamping barcodes on existing PDFs. When reading barcodes from PDFs, use the PDF barcode reader settings for optimal results.

How Do I Implement QR Codes in Web Applications?

For ASP.NET MVC applications, implement streaming without file I/O. The library supports creating barcodes as HTML for direct web integration:

public IActionResult GetQrCode(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 400);
    byte[] qrBytes = qr.ToPngBinaryData();
    return File(qrBytes, "image/png", "qrcode.png");
}

// Stream directly without disk I/O
public IActionResult StreamQrCode(string content)
{
    var qr = QRCodeWriter.CreateQrCode(content, 500);
    var stream = qr.ToStream();
    return File(stream, "image/png");
}

// Generate HTML-embedded QR codes
public IActionResult GetHtmlQrCode(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 400);
    var htmlString = qr.ToHtmlTag();
    return Content(htmlString, "text/html");
}
public IActionResult GetQrCode(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 400);
    byte[] qrBytes = qr.ToPngBinaryData();
    return File(qrBytes, "image/png", "qrcode.png");
}

// Stream directly without disk I/O
public IActionResult StreamQrCode(string content)
{
    var qr = QRCodeWriter.CreateQrCode(content, 500);
    var stream = qr.ToStream();
    return File(stream, "image/png");
}

// Generate HTML-embedded QR codes
public IActionResult GetHtmlQrCode(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 400);
    var htmlString = qr.ToHtmlTag();
    return Content(htmlString, "text/html");
}
$vbLabelText   $csharpLabel

For Blazor applications, implement reactive QR code generation:

@page "/qrcode"
@using IronBarCode

<input @bind="qrText" placeholder="Enter text" />
<button @onclick="GenerateQr">Generate</button>

@if (!string.IsNullOrEmpty(QrCodeDataUrl))
{
    <img src="@QrCodeDataUrl" alt="QR Code" />
}

@code {
    private string qrText = "";
    private string QrCodeDataUrl = "";

    private void GenerateQr()
    {
        if (!string.IsNullOrEmpty(qrText))
        {
            var qr = QRCodeWriter.CreateQrCode(qrText, 400);
            QrCodeDataUrl = qr.ToDataUrl();
        }
    }
}
@page "/qrcode"
@using IronBarCode

<input @bind="qrText" placeholder="Enter text" />
<button @onclick="GenerateQr">Generate</button>

@if (!string.IsNullOrEmpty(QrCodeDataUrl))
{
    <img src="@QrCodeDataUrl" alt="QR Code" />
}

@code {
    private string qrText = "";
    private string QrCodeDataUrl = "";

    private void GenerateQr()
    {
        if (!string.IsNullOrEmpty(qrText))
        {
            var qr = QRCodeWriter.CreateQrCode(qrText, 400);
            QrCodeDataUrl = qr.ToDataUrl();
        }
    }
}
$vbLabelText   $csharpLabel

For exporting barcodes as HTML, review the create barcode as HTML guide. When applying licenses in web applications, see the web.config license key guide.

What Are the Best Practices for QR Code Implementation?

Which Error Correction Level Should I Choose?

Error correction affects resilience and capacity. For detailed information, see the error correction guide. The library includes machine learning confidence thresholds for improved accuracy:

LevelRecoveryUse Case
Low7%Clean digital environments
Medium15%Print materials, business cards
High25%Outdoor signage, handled items
Highest30%Industrial use, logos added

What Size Should My QR Codes Be?

Calculate optimal size based on scanning distance. Learn about setting margins for improved scanning. The margin setting example demonstrates best practices:

// 1:10 ratio - 1cm QR per 10cm distance
int CalculateQrSize(double scanDistanceMeters)
{
    int sizeInCm = (int)(scanDistanceMeters * 10);
    return (int)(sizeInCm * 37.8); // Convert to pixels at 96 DPI
}

// Set appropriate margins for reliable scanning
public GeneratedBarcode CreateScanOptimizedQr(string data, int scanDistance)
{
    int size = CalculateQrSize(scanDistance);
    var qr = QRCodeWriter.CreateQrCode(data, size);
    qr.SetMargins(size / 20); // 5% margin
    return qr;
}
// 1:10 ratio - 1cm QR per 10cm distance
int CalculateQrSize(double scanDistanceMeters)
{
    int sizeInCm = (int)(scanDistanceMeters * 10);
    return (int)(sizeInCm * 37.8); // Convert to pixels at 96 DPI
}

// Set appropriate margins for reliable scanning
public GeneratedBarcode CreateScanOptimizedQr(string data, int scanDistance)
{
    int size = CalculateQrSize(scanDistance);
    var qr = QRCodeWriter.CreateQrCode(data, size);
    qr.SetMargins(size / 20); // 5% margin
    return qr;
}
$vbLabelText   $csharpLabel

How Do I Ensure Mobile Compatibility?

Improve for mobile scanning using barcode reader settings. When dealing with recognition issues, consult the barcode not recognized troubleshooting guide:

public GeneratedBarcode CreateMobileOptimizedQr(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 800, QRCodeWriter.QrErrorCorrectionLevel.Medium);
    qr.SetMargins(20); // Adequate quiet zone
    qr.ChangeBarCodeColor(System.Drawing.Color.Black);
    qr.ChangeBackgroundColor(System.Drawing.Color.White);
    return qr;
}
public GeneratedBarcode CreateMobileOptimizedQr(string data)
{
    var qr = QRCodeWriter.CreateQrCode(data, 800, QRCodeWriter.QrErrorCorrectionLevel.Medium);
    qr.SetMargins(20); // Adequate quiet zone
    qr.ChangeBarCodeColor(System.Drawing.Color.Black);
    qr.ChangeBackgroundColor(System.Drawing.Color.White);
    return qr;
}
$vbLabelText   $csharpLabel

For cross-platform mobile development, explore the .NET MAUI barcode scanner tutorial. The library supports both iOS and Android platforms natively.## Common Integration Scenarios

Creating Marketing Campaign QR Codes

To implement trackable marketing QR codes with custom branding, refer to the reading speeds guide for managing barcode reading speed:

public GeneratedBarcode CreateCampaignQr(string campaignId, string userId)
{
    string trackingUrl = "___PROTECTED_URL_79___";
    var qr = QRCodeWriter.CreateQrCodeWithLogo(trackingUrl, "logo.png", 1000);
    qr.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml("#1E3A8A"));
    qr.AddAnnotationTextAboveBarcode($"Campaign: {campaignId}");
    return qr;
}

// Batch generate campaign materials
public async Task GenerateCampaignBatch(List<string> userIds, string campaignId)
{
    var tasks = userIds.Select(async userId =>
    {
        var qr = CreateCampaignQr(campaignId, userId);
        await Task.Run(() => qr.SaveAsPng($"campaigns/{campaignId}/{userId}.png"));
    });

    await Task.WhenAll(tasks);
}
public GeneratedBarcode CreateCampaignQr(string campaignId, string userId)
{
    string trackingUrl = "___PROTECTED_URL_79___";
    var qr = QRCodeWriter.CreateQrCodeWithLogo(trackingUrl, "logo.png", 1000);
    qr.ChangeBarCodeColor(System.Drawing.ColorTranslator.FromHtml("#1E3A8A"));
    qr.AddAnnotationTextAboveBarcode($"Campaign: {campaignId}");
    return qr;
}

// Batch generate campaign materials
public async Task GenerateCampaignBatch(List<string> userIds, string campaignId)
{
    var tasks = userIds.Select(async userId =>
    {
        var qr = CreateCampaignQr(campaignId, userId);
        await Task.Run(() => qr.SaveAsPng($"campaigns/{campaignId}/{userId}.png"));
    });

    await Task.WhenAll(tasks);
}
$vbLabelText   $csharpLabel

Generating Product Label QR Codes

Create QR codes for inventory management. For handling special formats, see the GS1-128 troubleshooting guide. When working with specific barcode types like Code 39 or MSI barcodes, consult format-specific guides:

public void GenerateProductLabel(Product product)
{
    var productData = new
    {
        sku = product.SKU,
        batch = product.BatchNumber,
        expiry = product.ExpiryDate.ToString("yyyy-MM-dd")
    };

    string json = System.Text.Json.JsonSerializer.Serialize(productData);
    var qr = QRCodeWriter.CreateQrCode(json, 400, QRCodeWriter.QrErrorCorrectionLevel.High);
    qr.AddAnnotationTextAboveBarcode(product.Name);
    qr.SaveAsPng($"labels/product-{product.SKU}.png");
}

// Generate 1-BPP labels for thermal printers
public void GenerateThermalLabel(Product product)
{
    var qr = CreateProductQr(product);
    qr.SaveAs1BitPerPixelPng($"thermal/{product.SKU}.png");
}
public void GenerateProductLabel(Product product)
{
    var productData = new
    {
        sku = product.SKU,
        batch = product.BatchNumber,
        expiry = product.ExpiryDate.ToString("yyyy-MM-dd")
    };

    string json = System.Text.Json.JsonSerializer.Serialize(productData);
    var qr = QRCodeWriter.CreateQrCode(json, 400, QRCodeWriter.QrErrorCorrectionLevel.High);
    qr.AddAnnotationTextAboveBarcode(product.Name);
    qr.SaveAsPng($"labels/product-{product.SKU}.png");
}

// Generate 1-BPP labels for thermal printers
public void GenerateThermalLabel(Product product)
{
    var qr = CreateProductQr(product);
    qr.SaveAs1BitPerPixelPng($"thermal/{product.SKU}.png");
}
$vbLabelText   $csharpLabel

For specialized label printing, review the 1-BPP barcode image guide. When reading multipage documents, see the multipage GIF and TIFF guide.

Improving Barcode Scanning Performance

For high-volume scanning applications, implement crop regions to limit scanning areas and improve performance. The reading speed options provide fine-tuned control over the accuracy-speed tradeoff:

// Define crop region for faster scanning
var cropRegion = new Rectangle(100, 100, 300, 300);
var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Faster,
    ExpectBarcodeTypes = BarcodeEncoding.QRCode,
    CropArea = cropRegion
};

var results = BarcodeReader.Read("image.png", options);
// Define crop region for faster scanning
var cropRegion = new Rectangle(100, 100, 300, 300);
var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Faster,
    ExpectBarcodeTypes = BarcodeEncoding.QRCode,
    CropArea = cropRegion
};

var results = BarcodeReader.Read("image.png", options);
$vbLabelText   $csharpLabel

When working with System.Drawing objects, the library provides cross-platform compatibility through IronDrawing.

Key Takeaways

IronBarcode offers a complete solution for QR code generation in .NET applications. The library provides intuitive APIs, extensive documentation, and production-ready features including fault tolerance, cross-platform support, and performance optimization. Stay updated with the latest features through the changelog. For security-conscious deployments, review the security CVE disclosures.

Find licensing information on the licensing page. IronBarcode offers a free developer license with premium options including support and updates. For existing customers, explore license extensions and upgrade options. If you need assistance with licensing, see the license key application guide and web.config licensing setup.

For production deployments, consider the guides for AWS Lambda, Azure Functions, and Docker containers. For troubleshooting specific deployment issues, see the AWS Lambda runtime guide and runtime copy exception solutions. When experiencing false positives, consult the detailed troubleshooting guide.

For technical support, submit an engineering request. The library undergoes regular updates as shown in the product updates section, ensuring continued compatibility and new features.

Getting Started with a Quick QR Code Example

Generate a QR code with custom styling in just a few lines of code. For more examples, visit the create barcode example and explore the reading barcodes tutorial for complete barcode solutions. Additional examples include reading barcodes from PDFs and creating barcodes from data:

using IronBarCode;

// Create QR code with custom size and error correction
var qrCode = QRCodeWriter.CreateQrCode("___PROTECTED_URL_81___", 500, QRCodeWriter.QrErrorCorrectionLevel.High);

// Add styling
qrCode.ChangeBarCodeColor(System.Drawing.Color.Navy);
qrCode.AddBarcodeValueTextBelowBarcode();

// Save as image
qrCode.SaveAsPng("quickstart-qr.png");

// Export for API
byte[] pngBytes = qrCode.ToPngBinaryData();
using IronBarCode;

// Create QR code with custom size and error correction
var qrCode = QRCodeWriter.CreateQrCode("___PROTECTED_URL_81___", 500, QRCodeWriter.QrErrorCorrectionLevel.High);

// Add styling
qrCode.ChangeBarCodeColor(System.Drawing.Color.Navy);
qrCode.AddBarcodeValueTextBelowBarcode();

// Save as image
qrCode.SaveAsPng("quickstart-qr.png");

// Export for API
byte[] pngBytes = qrCode.ToPngBinaryData();
$vbLabelText   $csharpLabel

IronBarcode supports deployment on AWS Lambda, Azure, Docker, and mobile platforms through .NET MAUI. For technical support, submit an engineering request. Review the security CVE disclosures for enterprise security requirements.

Explore the reading barcodes features to understand the full capabilities of barcode recognition, including support for reading Code 39 barcodes and other specialized formats. The library's complete feature set makes it suitable for enterprise applications requiring reliable barcode generation and scanning capabilities.

Frequently Asked Questions

How do I generate a QR code in a .NET application?

You can generate a QR code in a .NET application by using the QRCodeWriter.CreateQrCode method in IronBarcode. This method allows you to specify the QR code data, size, and error correction level.

What are the customization options available for QR codes?

IronBarcode allows customization of QR codes, including changing colors and embedding images such as company logos. These features enhance the visual appeal and brand integration of the QR codes.

How can I install the IronBarcode library in my project?

You can install IronBarcode in your project through Visual Studio's NuGet Package Manager UI, Package Manager Console, or by downloading it from the NuGet website.

Can IronBarcode be used to read barcodes from video frames?

Yes, IronBarcode can process video frames, allowing it to read barcodes in real-time by correcting for rotation and noise, thereby enhancing the barcode reading efficiency.

What file formats can be used to save QR codes generated with IronBarcode?

QR codes generated with IronBarcode can be saved in multiple formats, including PNG and HTML, providing flexibility for different application needs.

Is IronBarcode suitable for both console and web applications?

Yes, IronBarcode is versatile and can be used in both console and .NET MVC web applications, making it a robust choice for various development environments.

What error correction levels are available for QR codes in IronBarcode?

IronBarcode supports four levels of error correction for QR codes: Low, Medium, High, and Highest, ensuring data integrity even if the QR code gets damaged.

What are the licensing options for IronBarcode?

IronBarcode offers a free developer license and a premium version that includes additional support and updates, catering to different development and business needs.

Is IronBarcode compatible with .NET Core and .NET Framework?

Yes, IronBarcode is compatible with both .NET Core and .NET Framework, supporting various architectures including 32- and 64-bit systems.

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he ...
Read More