TyKonKet.BarcodeGenerator
2.1.0
dotnet add package TyKonKet.BarcodeGenerator --version 2.1.0
NuGet\Install-Package TyKonKet.BarcodeGenerator -Version 2.1.0
<PackageReference Include="TyKonKet.BarcodeGenerator" Version="2.1.0" />
<PackageVersion Include="TyKonKet.BarcodeGenerator" Version="2.1.0" />
<PackageReference Include="TyKonKet.BarcodeGenerator" />
paket add TyKonKet.BarcodeGenerator --version 2.1.0
#r "nuget: TyKonKet.BarcodeGenerator, 2.1.0"
#:package TyKonKet.BarcodeGenerator@2.1.0
#addin nuget:?package=TyKonKet.BarcodeGenerator&version=2.1.0
#tool nuget:?package=TyKonKet.BarcodeGenerator&version=2.1.0
π BarcodeGenerator
A compact, SkiaSharp-based .NET library for generating common 1D barcodes. Focused on reliability, correctness and a small API surface so it's easy to use from services and agent workflows.
Example:
using var barcode = new Barcode(opt => opt.Type = BarcodeTypes.Ean13);
string validated = barcode.Encode("123456789012");
barcode.Export("barcode.png");
π Documentation
π Complete Documentation - Comprehensive guides, API reference, and examples
Quick Links
- Getting Started Guide - Generate your first barcode in minutes
- API Reference - Complete class and method documentation
- Code Examples - Common usage patterns and scenarios
- Advanced Topics - Custom fonts, validation, and optimization
π Supported Barcode Types
10 industry-standard formats for every use case:
| Type | Use Case | Example |
|---|---|---|
| EAN-13 | π Retail products, European standard | 1234567890128 |
| UPC-A | πΊπΈ North American retail, grocery | 012345678905 |
| UPC-E | π¦ Compact retail, small packages | 01234565 |
| ISBN-13 | π Books and publications | 9781234567897 |
| EAN-8 | π¦ Small packages, compact spaces | 12345670 |
| CODE-39 | π Industrial, automotive, defense | ABC-123 |
| CODE-93 | π Logistics, inventory management | ABC123 |
| CODE-128 | π High-density alphanumeric encoding | ABC123xyz |
| CODABAR | π₯ Libraries, blood banks, logistics | A123456A |
| ITF | π¦ Distribution, warehousing, cartons | 12345678 |
Key points
- Compact, easy-to-use API (fluent configuration)
- Built-in validation helpers (see
BarcodeValidator) - Export templating: use placeholders like
{barcode},{format}in file names - Cross-platform rendering using SkiaSharp
π¦ Installation
Choose your preferred installation method:
Package Manager Console:
Install-Package TyKonKet.BarcodeGenerator
CLI Command:
dotnet add package TyKonKet.BarcodeGenerator
π― Quick Start
Get up and running in 30 seconds:
1οΈβ£ Install
dotnet add package TyKonKet.BarcodeGenerator
2οΈβ£ Generate
using SkiaSharp;
using TyKonKet.BarcodeGenerator;
// Simple barcode generation
using var barcode = new Barcode(options => {
options.Type = BarcodeTypes.Ean13;
options.Height = 50;
options.Scaling = 3;
});
string validatedCode = barcode.Encode("123456789012");
barcode.Export("my-barcode.png");
3οΈβ£ Customize
// Advanced styling with custom colors and fonts
using var styledBarcode = new Barcode(options => {
options.Type = BarcodeTypes.Ean13;
options.ForegroundColor = SKColors.DarkBlue;
options.TextColor = SKColors.Red; // π Independent text color!
options.BackgroundColor = SKColors.LightGray;
options.UseTypeface("Arial", SKFontStyle.Bold);
options.Margins = 10;
});
string result = styledBarcode.Encode("123456789012");
styledBarcode.Export("styled-barcode.png", SKEncodedImageFormat.Png, 100);
π₯ Pro Tip: Export Templating
// Dynamic file naming with placeholders
barcode.Export("output/{barcode}_{quality}.{format}", SKEncodedImageFormat.Png, 95);
// Creates: output/1234567890128_95.png
β Validate Before Encoding
// NEW: Validate barcode data without encoding
var result = BarcodeValidator.Validate("123456789012", BarcodeTypes.Ean13);
if (result.IsValid)
{
Console.WriteLine($"β Valid: {result.ValidatedBarcode}");
// Output: β Valid: 1234567890128 (with check digit)
}
else
{
Console.WriteLine($"β Errors: {string.Join(", ", result.Errors)}");
// Get suggestions for compatible barcode types (opt-in)
var resultWithSuggestions = BarcodeValidator.Validate("ABC123", BarcodeTypes.Ean13, includeSuggestions: true);
if (resultWithSuggestions.SuggestedTypes.Count > 0)
{
Console.WriteLine($"π‘ Try: {string.Join(", ", resultWithSuggestions.SuggestedTypes)}");
}
}
π‘ Need more help? Check out our Getting Started Guide for step-by-step tutorials and examples.
π Validation API: See the complete Validation API Documentation for detailed usage.
Common use cases
- E-commerce product barcodes (EAN/UPC)
- Inventory and asset tracking
- Library ISBN generation
- Label printing and batch export
π Configuration Options
The BarcodeOptions class provides extensive customization capabilities:
| Option | Description | Default |
|---|---|---|
| Type | Barcode encoding type (EAN-13, UPC-A, ISBN-13, EAN-8, CODE-93, CODE-128) | EAN-8 |
| Height | Height of barcode bars | 30 pixels |
| Scaling | Scale factor for the entire image | 5x |
| Margins | Spacing around the barcode | 2 pixels |
| Colors | Background, foreground, and text colors (independent control) | White/Black |
| Text Rendering | Show/hide text below barcode | Enabled |
| Font Options | Custom fonts, styles, and loading methods | System default |
π Detailed Configuration: See our BarcodeOptions API Reference for complete documentation.
π§ Framework Compatibility
BarcodeGenerator supports multiple .NET framework versions for maximum compatibility:
| Framework | Version | Target Scenario |
|---|---|---|
| .NET Standard 2.0 | 2.0+ | Core compatibility for most scenarios |
| .NET Framework | 4.6.2+ | Legacy Windows applications |
| .NET 8.0 | 8.0+ | Long-term support version |
| .NET 10.0 | 10.0+ | Latest stable version |
π Breaking Changes
Version 2.1.0
- PolySharp Integration: The library now includes the
PolySharppackage to enhance compatibility. If you encounter any issues, please report them by opening an issue on our GitHub repository. For more details, visit the PolySharp GitHub repository. - API Rename:
EncodesExtensionshas been renamed toBarcodeTypeExtensionsto better reflect its purpose. Update consuming code accordingly. - Framework requirement: .NET 6 support has been dropped in favor of the current
net8.0/net10.0targets; make sure callers move to those runtimes.
Version 2.0.0
- Framework Requirement: No longer supports .NET Standard 1.3 (requires .NET Standard 2.0+).
- API Changes: Redesigned for improved usability and customization.
- SkiaSharp Update: Updated to SkiaSharp 3.116.1 for better performance.
π Migration Guide: See our Getting Started documentation for updated API usage patterns.
πΊοΈ Roadmap
β Recently completed
- CODE-39, CODE-128, CODABAR, ITF and UPC-E
- Validation API: standalone validation without encoding (
BarcodeValidator) - PolySharp integration to improve compatibility across target frameworks
- Independent text color support (
BarcodeOptions.TextColor) and rendering improvements
Have an idea? Start a discussion or vote on features!
π€ Contributing
We welcome contributions from the community! π
π Full Contributing Guide - Complete guide to contributing with setup, workflows, and guidelines
Quick Start:
- π Found a bug? Report it here
- β¨ Have an idea? Start a discussion
- π Ready to code? Check out good first issues
Essential Checks:
- Run tests:
dotnet test --configuration Release - Check coverage:
./tools/run-coverage.sh - Follow our Code of Conduct
Every contribution matters - from typo fixes to new features! β¨
π License
This library is released under the MIT License. See the LICENSE file for details.
π Explore Full Documentation | π Getting Started Guide | π§ API Reference
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- SkiaSharp (>= 3.119.1)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.1)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
- System.Threading.Tasks.Extensions (>= 4.6.3)
- System.ValueTuple (>= 4.6.1)
-
.NETStandard 2.0
- SkiaSharp (>= 3.119.1)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.1)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
- System.Threading.Tasks.Extensions (>= 4.6.3)
-
net10.0
- SkiaSharp (>= 3.119.1)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.1)
-
net8.0
- SkiaSharp (>= 3.119.1)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.