Lyo.Barcode 2.0.1

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

Lyo.Barcode

Contracts for generating and decoding barcodes: IBarcodeService, request and options models, plus BarcodeBuilder. Companion packages such as Lyo.Barcode.Native own concrete rendering and symbology.

Examples

First generate call

using Lyo.Barcode;
using Lyo.Barcode.Models;

// Assume IBarcodeService is registered (e.g. Native implementation).
IBarcodeService barcodes = /* ... */;

var result = await barcodes.GenerateAsync(
    "HELLO-128",
    BarcodeSymbology.Code128,
    new BarcodeOptions { Format = BarcodeFormat.Svg, ModuleWidthPixels = 2, BarHeightPixels = 64 });

if (result.IsSuccess && result is BarcodeResult br && br.ImageBytes != null)
    await File.WriteAllBytesAsync("out.svg", br.ImageBytes);

Build with the fluent API

var (data, sym, opts) = BarcodeBuilder.New()
    .WithData("SKU-12345")
    .WithSymbology(BarcodeSymbology.Code128)
    .WithFormat(BarcodeFormat.Bmp)
    .WithModuleWidthPixels(2)
    .WithBarHeightPixels(96)
    .WithShowHumanReadableTextBelow(true)
    .WithShowBorder(true)
    .WithBorderWidthPixels(4)
    .WithBorderColorHex("#000000")
    .Build();

await barcodes.GenerateAsync(data, sym, opts);

Read a barcode from image bytes

var read = await barcodes.ReadFromImageAsync(pngBytes);
if (read.IsSuccess && read.Data != null)
    Console.WriteLine(read.Data.Text);

Public types

Type Description
IBarcodeService Build barcodes from a string or BarcodeBuilder, write them to a stream or file, run a batch, and decode raster bytes.
BarcodeBuilder Fluent builder for payload, BarcodeSymbology, and BarcodeOptions (module width, colors, human-readable text, border).
BarcodeRequest One batch item: Data, Symbology, optional Options, optional Id.
BarcodeOptions Raster/SVG size, colors, quiet zone, caption under the bars, optional border frame.
BarcodeServiceOptions Limits and defaults implementations inherit from the host. See SectionName.
BarcodeResult Result<BarcodeRequest> carrying ImageBytes, dimensions, and format.
BarcodeImageReadResult What the decoder returns: Text, FormatName.
BarcodeSymbology, BarcodeFormat Symbologies and output formats that are supported.
BarcodeErrorCodes Stable failure code strings.

How the border is drawn

If BarcodeOptions.ShowBorder is true, Lyo.Barcode.Native grows width and height by 2 × BorderWidthPixels and paints a filled frame in BorderColorHex around the symbol. The usual background and bars stay the same inside that inset. BarcodeServiceOptions.MinBorderWidthPixels / MaxBorderWidthPixels clamp the width (defaults 1 to 64). When the border is on, BorderColorHex must be #RGB or #RRGGBB.

Binding from configuration

Implementations can bind BarcodeServiceOptions from the BarcodeService section (see BarcodeServiceOptions.SectionName).

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Exceptions (direct, lyo)
  • Lyo.Metrics (direct, lyo)
  • Lyo.Result (direct, lyo)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 (direct, microsoft)
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 Lyo.Barcode:

Package Downloads
Lyo.Barcode.Web.Components

Reusable Blazor components for barcode generation and preview workflows.

Lyo.Barcode.Native

Native barcode implementation for Lyo.Barcode - includes Code128 encoding, image rendering, and ZXing-based barcode reading.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 69 9/14/2026
2.0.0 104 9/9/2026
1.0.13 245 8/25/2026
1.0.11 132 8/23/2026
1.0.9 142 8/22/2026
1.0.6 134 8/20/2026
1.0.4 137 8/20/2026
1.0.3 139 8/19/2026
1.0.2 132 8/19/2026
1.0.1 140 8/18/2026
1.0.0 133 8/16/2026