Mab.PipelineFramework.BarcodeGenerator.Abstractions 1.0.0

dotnet add package Mab.PipelineFramework.BarcodeGenerator.Abstractions --version 1.0.0
                    
NuGet\Install-Package Mab.PipelineFramework.BarcodeGenerator.Abstractions -Version 1.0.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="Mab.PipelineFramework.BarcodeGenerator.Abstractions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mab.PipelineFramework.BarcodeGenerator.Abstractions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Mab.PipelineFramework.BarcodeGenerator.Abstractions" />
                    
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 Mab.PipelineFramework.BarcodeGenerator.Abstractions --version 1.0.0
                    
#r "nuget: Mab.PipelineFramework.BarcodeGenerator.Abstractions, 1.0.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 Mab.PipelineFramework.BarcodeGenerator.Abstractions@1.0.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=Mab.PipelineFramework.BarcodeGenerator.Abstractions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Mab.PipelineFramework.BarcodeGenerator.Abstractions&version=1.0.0
                    
Install as a Cake Tool

PipelineFramework.BarcodeGenerator.Abstractions

Abstractions for barcode and QR code generation. This package provides interfaces, options, and result types for generating various barcode formats.

Installation

dotnet add package Mab.PipelineFramework.BarcodeGenerator.Abstractions

Overview

This package contains:

  • Interfaces: IBarcodeGenerator, IQRCodeGenerator, IBarcodeGeneratorFactory
  • Options: BarcodeOptions, QRCodeOptions, DataMatrixOptions
  • Enums: BarcodeType, OutputFormat, ErrorCorrectionLevel
  • Result Types: BarcodeResult, BarcodeMetadata, BarcodeError
  • Utilities: BarcodeColor, BarcodeValidationResult

Supported Barcode Types

2D Barcodes (Matrix)

Type Description Use Cases
QR Code High capacity, error correction URLs, contact info, payments
Data Matrix Compact, industrial Electronics, healthcare
PDF417 High capacity stacked ID cards, shipping
Aztec No quiet zone required Tickets, boarding passes

1D Barcodes (Linear)

Type Characters Use Cases
Code 128 Full ASCII Shipping, inventory
Code 39 A-Z, 0-9, symbols Automotive, defense
EAN-13 13 digits Retail worldwide
EAN-8 8 digits Small packages
UPC-A 12 digits North American retail
UPC-E 6-8 digits Small packages
ITF Numeric pairs Warehousing

Usage

Basic Interface Usage

public class InvoiceService
{
    private readonly IBarcodeGenerator _generator;

    public InvoiceService(IBarcodeGenerator generator)
    {
        _generator = generator;
    }

    public async Task<byte[]> CreateInvoiceBarcodeAsync(string invoiceId)
    {
        var result = await _generator.GenerateQRCodeAsync(
            $"INV:{invoiceId}",
            new QRCodeOptions
            {
                Width = 200,
                Height = 200,
                ErrorCorrectionLevel = ErrorCorrectionLevel.Medium
            });

        return result.GetDataOrThrow();
    }
}

Barcode Options

// 1D Barcode options
var barcodeOptions = new BarcodeOptions
{
    BarcodeType = BarcodeType.Code128,
    Width = 300,
    Height = 100,
    ShowText = true,
    ForegroundColor = BarcodeColor.Black,
    BackgroundColor = BarcodeColor.White
};

// QR Code options with logo
var qrOptions = new QRCodeOptions
{
    Width = 400,
    Height = 400,
    ErrorCorrectionLevel = ErrorCorrectionLevel.High,
    LogoData = File.ReadAllBytes("logo.png"),
    LogoSizeRatio = 0.2,
    ModuleShape = QRCodeModuleShape.RoundedSquare,
    UseGradient = true,
    GradientStartColor = BarcodeColor.FromHex("#1E3A8A"),
    GradientEndColor = BarcodeColor.FromHex("#7C3AED")
};

Result Handling

var result = generator.GenerateQRCode("https://example.com");

// Pattern matching
if (result.IsSuccess)
{
    // Save to file
    await result.SaveAsync("qrcode.png");

    // Or get as data URL for HTML
    var dataUrl = result.ToDataUrl();
    // <img src="{dataUrl}" />
}
else
{
    Console.WriteLine($"Error: {result.Error}");
}

// Functional style
result
    .OnSuccess((data, metadata) => Console.WriteLine($"Generated {metadata.SizeBytes} bytes"))
    .OnFailure(error => Console.WriteLine($"Failed: {error.Message}"));

// Match pattern
var message = result.Match(
    onSuccess: (data, meta) => $"Success! {meta.Width}x{meta.Height}",
    onFailure: error => $"Error: {error.Code}"
);

Color Utilities

// Predefined colors
var black = BarcodeColor.Black;
var white = BarcodeColor.White;

// From hex
var brand = BarcodeColor.FromHex("#FF5733");

// From HSL
var hsl = BarcodeColor.FromHsl(210, 0.8, 0.5);

// Check contrast (important for scanning)
if (!foreground.HasSufficientContrast(background))
{
    // Warning: low contrast may cause scanning issues
}
  • Mab.PipelineFramework.BarcodeGenerator: Implementation package with QRCoder and ZXing.Net
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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Mab.PipelineFramework.BarcodeGenerator.Abstractions:

Package Downloads
Mab.PipelineFramework.BarcodeGenerator

High-quality barcode and QR code generator for .NET. Generate QR codes with logos, custom colors, gradients, and shapes. Supports Code128, Code39, EAN-13, EAN-8, UPC-A, PDF417, Data Matrix and more. Features fluent API, DI integration, multiple output formats (PNG, SVG, Base64), and comprehensive error handling.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 277 12/12/2025