Acontplus.Barcode 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Acontplus.Barcode --version 1.2.0
                    
NuGet\Install-Package Acontplus.Barcode -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Acontplus.Barcode" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Acontplus.Barcode" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Acontplus.Barcode" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Acontplus.Barcode --version 1.2.0
                    
#r "nuget: Acontplus.Barcode, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Acontplus.Barcode@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Acontplus.Barcode&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Acontplus.Barcode&version=1.2.0
                    
Install as a Cake Tool

Acontplus.Barcode

NuGet .NET License

Advanced barcode generation library with ZXing.Net integration. Supports QR codes, 1D/2D barcodes, custom styling, and high-performance image generation using SkiaSharp for cross-platform applications.

🚀 Features

📱 Barcode Formats

  • QR Codes - High-capacity 2D barcodes with error correction
  • Code 128 - High-density linear barcode for alphanumeric data
  • Code 39 - Industrial barcode standard for alphanumeric data
  • EAN-13 - European Article Number for retail products
  • EAN-8 - Compact version of EAN for small products
  • UPC-A - Universal Product Code for retail products
  • UPC-E - Compact UPC for small products
  • PDF417 - High-capacity 2D barcode for large data
  • Data Matrix - Compact 2D barcode for small items

🎨 Customization Options

  • Custom Colors - Foreground and background color customization via SKColor
  • Size Control - Adjustable width, height, and margins
  • Error Correction - Configurable error correction levels for QR codes
  • Format Options - PNG, JPEG, and other image formats
  • Cross-Platform - SkiaSharp rendering for consistent output

📦 Installation

NuGet Package Manager

bash Install-Package Acontplus.Barcode

.NET CLI

bash dotnet add package Acontplus.Barcode

PackageReference

xml <PackageReference Include="Acontplus.Barcode" Version="1.1.4" />

🎯 Quick Start

csharp // Program.cs builder.Services.AddBarcode();

Then inject IBarcodeService wherever needed:

csharp public class MyService(IBarcodeService barcodeService) { public byte[] GetQrCode(string url) => barcodeService.Create(new BarcodeConfig { Text = url, Format = ZXing.BarcodeFormat.QR_CODE, Width = 300, Height = 300 }); }

2. Static Usage

``csharp using Acontplus.Barcode.Utils; using Acontplus.Barcode.Models;

var config = new BarcodeConfig { Text = "https://example.com", Format = ZXing.BarcodeFormat.QR_CODE, Width = 300, Height = 300 }; var qrCode = BarcodeGen.Create(config); await File.WriteAllBytesAsync("qr-code.png", qrCode); ``

3. Code 128 Barcode with Custom Settings

``csharp var config = new BarcodeConfig { Text = "123456789", Format = ZXing.BarcodeFormat.CODE_128, Width = 400, Height = 100, Margin = 10, IncludeLabel = false, OutputFormat = SkiaSharp.SKEncodedImageFormat.Png, Quality = 100 };

var barcode = BarcodeGen.Create(config); await File.WriteAllBytesAsync("barcode.png", barcode); ``

4. Multiple Barcode Formats

``csharp var formats = new[] { ZXing.BarcodeFormat.QR_CODE, ZXing.BarcodeFormat.CODE_128, ZXing.BarcodeFormat.CODE_39, ZXing.BarcodeFormat.EAN_13, ZXing.BarcodeFormat.PDF_417 };

foreach (var format in formats) { var config = new BarcodeConfig { Text = "Sample Data", Format = format, Width = 300, Height = 100 };

var barcode = BarcodeGen.Create(config);
await File.WriteAllBytesAsync($"{format}.png", barcode);

} ``

🔧 Advanced Usage

QR Code with Error Correction

``csharp var config = new BarcodeConfig { Text = "Important data that needs error correction", Format = ZXing.BarcodeFormat.QR_CODE, Width = 400, Height = 400, Margin = 20, AdditionalOptions = new ZXing.QrCode.QrCodeEncodingOptions { ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H } };

var qrCode = BarcodeGen.Create(config); ``

Custom Colors

``csharp var config = new BarcodeConfig { Text = "COLOR BARCODE", Format = ZXing.BarcodeFormat.QR_CODE, Width = 300, Height = 300, ForegroundColor = SkiaSharp.SKColors.DarkBlue, BackgroundColor = SkiaSharp.SKColors.LightYellow };

var barcode = BarcodeGen.Create(config); ``

Batch Generation

``csharp var items = new[] { "Item001", "Item002", "Item003", "Item004" };

for (int i = 0; i < items.Length; i++) { var config = new BarcodeConfig { Text = items[i], Format = ZXing.BarcodeFormat.CODE_128, Width = 300, Height = 80 };

var barcode = BarcodeGen.Create(config);
await File.WriteAllBytesAsync($"item_{i + 1}.png", barcode);

} ``

Large Data with PDF417

``csharp var config = new BarcodeConfig { Text = "Large amount of data that needs to be encoded in a compact 2D format", Format = ZXing.BarcodeFormat.PDF_417, Width = 400, Height = 200 };

var barcode = BarcodeGen.Create(config); ``

📊 Barcode Format Comparison

Format Type Data Capacity Use Case
QR Code 2D High URLs, contact info, general data
Code 128 1D Medium Inventory, shipping, logistics
Code 39 1D Medium Industrial, automotive, defense
EAN-13 1D Low Retail products, point of sale
UPC-A 1D Low Retail products, North America
PDF417 2D High Government IDs, shipping labels
Data Matrix 2D Medium Small items, electronics

🎨 Configuration Options

BarcodeConfig Properties

csharp public class BarcodeConfig { public string Text { get; set; } // Required: text to encode public ZXing.BarcodeFormat Format { get; set; } // Default: CODE_128 public int Width { get; set; } // Default: 300 public int Height { get; set; } // Default: 100 public bool IncludeLabel { get; set; } // Default: false public int Margin { get; set; } // Default: 10 public SkiaSharp.SKEncodedImageFormat OutputFormat { get; set; } // Default: Png public int Quality { get; set; } // Default: 100 (0-100) public SkiaSharp.SKColor? ForegroundColor { get; set; } // Default: Black public SkiaSharp.SKColor? BackgroundColor { get; set; } // Default: White public ZXing.Common.EncodingOptions? AdditionalOptions { get; set; } // Format-specific options }

Error Correction Levels (QR Codes)

Set via AdditionalOptions using ZXing.QrCode.QrCodeEncodingOptions:

  • L (Low) - 7% recovery capacity
  • M (Medium) - 15% recovery capacity
  • Q (Quartile) - 25% recovery capacity
  • H (High) - 30% recovery capacity

🔍 Best Practices

1. Choose the Right Format

``csharp // For URLs and general data var qrConfig = new BarcodeConfig { Text = "https://example.com", Format = BarcodeFormat.QR_CODE };

// For inventory systems var code128Config = new BarcodeConfig { Text = "INV-001", Format = BarcodeFormat.CODE_128 };

// For retail products var eanConfig = new BarcodeConfig { Text = "5901234123457", Format = BarcodeFormat.EAN_13 }; ``

2. Optimize Size and Quality

``csharp // High-quality QR code for printing var highQuality = new BarcodeConfig { Text = "https://example.com", Format = BarcodeFormat.QR_CODE, Width = 600, Height = 600, AdditionalOptions = new ZXing.QrCode.QrCodeEncodingOptions { ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H } };

// Compact barcode for web display var compact = new BarcodeConfig { Text = "123456789", Format = BarcodeFormat.CODE_128, Width = 200, Height = 60 }; ``

3. Parallel Batch Processing

csharp var barcodes = await Task.WhenAll(items.Select(item => Task.Run(() => BarcodeGen.Create(new BarcodeConfig { Text = item, Format = BarcodeFormat.CODE_128, Width = 300, Height = 100 }))));

📚 API Reference

BarcodeGen (static utility)

csharp public static class BarcodeGen { /// <summary>Generates a barcode image and returns its raw bytes.</summary> public static byte[] Create(BarcodeConfig config); }

IBarcodeService (DI interface)

csharp public interface IBarcodeService { byte[] Create(BarcodeConfig config); }

Register with services.AddBarcode() — the default implementation delegates to BarcodeGen.Create.

🔧 Dependencies

  • .NET 10+ - Modern .NET framework
  • ZXing.Net - Barcode encoding engine
  • ZXing.Net.Bindings.SkiaSharp - SkiaSharp renderer for ZXing
  • SkiaSharp.NativeAssets.Linux - Native assets for Linux containers
  • System.Drawing.Common - Cross-platform image support
  • Microsoft.Extensions.DependencyInjection.Abstractions - DI registration helpers

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

bash git clone https://github.com/acontplus/acontplus-dotnet-libs.git cd acontplus-dotnet-libs dotnet restore dotnet build

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

  • 📧 Email: proyectos@acontplus.com
  • 🐛 Issues: GitHub Issues
  • 📖 Documentation: Wiki

👨‍💻 Author

Ivan Paz - @iferpaz7

🏢 Company

Acontplus - Software solutions


Built with ❤️ for the .NET community using cutting-edge .NET features

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Acontplus.Barcode:

Package Downloads
Acontplus.Reports

Advanced library for comprehensive report generation and management. Includes RDLC report processing, PDF/Excel export capabilities, ReportViewer integration, QuestPDF dynamic PDF generation with fluent composition, MiniExcel high-performance streaming Excel exports, ClosedXML advanced richly formatted Excel workbooks with corporate styles, freeze panes, autofilter and formula aggregates, template support, and enterprise-ready reporting patterns for business applications.

Acontplus.Billing

Complete library for electronic invoicing and SRI integration in Ecuador. Includes models, services, XML validation, SRI web service support, and embedded XSD schemas for compliance.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 235 3/17/2026
1.2.1 129 3/8/2026
1.2.0 79 3/8/2026
1.1.3 235 2/22/2026
1.1.2 173 1/16/2026
1.1.1 492 12/11/2025
1.1.0 293 11/23/2025
1.0.7 499 11/2/2025
1.0.6 240 10/23/2025
1.0.5 348 9/25/2025
1.0.4 362 9/9/2025
1.0.3 364 8/7/2025
1.0.2 320 8/5/2025
1.0.1 486 7/9/2025
1.0.0 505 6/30/2025

Enhanced with ZXing.Net integration, SkiaSharp rendering, support for
     multiple barcode formats (QR, Code128, Code39, EAN, UPC, PDF417, DataMatrix), custom styling
     options, and high-performance cross-platform image generation.