NetBarcode 2.0.0-beta.1

.NET Standard 2.0
This is a prerelease version of NetBarcode.
NuGet\Install-Package NetBarcode -Version 2.0.0-beta.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.
dotnet add package NetBarcode --version 2.0.0-beta.1
<PackageReference Include="NetBarcode" Version="2.0.0-beta.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetBarcode --version 2.0.0-beta.1
#r "nuget: NetBarcode, 2.0.0-beta.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetBarcode as a Cake Addin
#addin nuget:?package=NetBarcode&version=2.0.0-beta.1&prerelease

// Install NetBarcode as a Cake Tool
#tool nuget:?package=NetBarcode&version=2.0.0-beta.1&prerelease

NetBarcode

NetBarcode Donwloads

Barcode generation library written in .NET Core compatible with .NET Standard 2.

Supported barcodes:

  • CODE128
    • CODE128 (automatic mode switching)
    • CODE128 A/B/C
  • EAN
    • EAN-13
    • EAN-8
  • CODE11
  • CODE39
  • CODE39E
  • CODE93
  • Codabar

Install

On Nuget:

PM> Install-Package NetBarcode

.NET CLI

> dotnet add package NetBarcode

Requirements

This library uses System.Drawing.Common which requires the following installed packages:

sudo apt install libc6-dev 
sudo apt install libgdiplus

Usage/Examples

Set configs

var barcode = new Barcode();
barcode.Configure(settings =>
{
    BackgroundColor = Color.Crimson
});

or

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    BackgroundColor = Color.Crimson
});

Use defaults

var barcode = new Barcode();
barcode.SaveImageFile("12345456", "barcode.png");

Change barcode type

var barcode = new Barcode();
barcode.Configure(settings =>
{
    settings.BarcodeType = BarcodeType.Code39E;
}).SaveImageFile("12345456", "barcode.png");

Output options

Image file void SaveImageFile(string data, string path, ImageFormat imageFormat = null)

var barcode = new Barcode();
barcode.SaveImageFile("12345456", "barcode.png", ImageFormat.Jpeg);

Base64 image string GetBase64Image(string data, ImageFormat imageFormat = null)

var barcode = new Barcode();
barcode.GetBase64Image("12345456", ImageFormat.Jpeg);

Byte array image byte[] GetByteArray(string data, ImageFormat imageFormat = null)

var barcode = new Barcode();
barcode.GetByteArray("12345456", ImageFormat.Jpeg);

Bitmap class Bitmap GetImage(string data)

var barcode = new Barcode();
barcode.GetImage("12345456");

Options

Option Default value Type
LineColor Black Color
BackgroundColor White Color
BarWidth 2 int
BarcodeHeight 150 int
ShowLabel true bool
LabelFont Font(FontFamily.GenericMonospace, 10, FontStyle.Regular) Font
LabelPosition BottomCenter LabelPosition
BarcodeType "auto" (CODE128) BarcodeType
Text string
Rotate RotateNoneFlipNone RotateFlipType

LineColor

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    LineColor = Color.Red
});

LineColor

BackgroundColor

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    BackgroundColor = Color.Red
});

BackgroundColor

BarWidth

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    BarWidth = 5
});

BarWidth

BarcodeHeight

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    BarcodeHeight = 250
});

BarcodeHeight

ShowLabel

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    ShowLabel = false
});

ShowLabel

LabelFont

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    LabelFont = new Font(FontFamily.GenericMonospace, 20, FontStyle.Italic)
});

LabelFont

LabelPosition

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    LabelPosition = LabelPosition.TopCenter
});

LabelPosition

BarcodeType

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    BarcodeType = BarcodeType.Code39E
});

BarcodeType

Text

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    Text = "New Text"
});

Text

Rotate

var barcode = new Barcode();
barcode.Configure(new BarcodeSettings
{
    Rotate = RotateFlipType.Rotate90FlipXY
});

Rotate

License

NetBarcode is shared under the MIT license. This means you can modify and use it however you want, even for comercial use. But please give this repository a ⭐️.

If you found it useful, please consider paying me a coffee.

paypal

paypal

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on NetBarcode:

Package Downloads
Bastion.Statements.Api

Package Description

Zideun.DFeBR.EmissorNFe

Novo framework para emissão e logística de documentos fiscais para a plataforma .NET, compatível com .NET Core e .NET 4.x

DFeBR.EmissorNFe

Novo framework para emissão e logística de documentos fiscais para a plataforma .NET, compatível com .NET Core e .NET 4.x

SktPublicLibrary

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0-beta.1 3,038 7/12/2021
1.7.0 4,478 7/22/2022
1.6.0 2,425 6/20/2022
1.5.2 670 6/16/2022
1.5.0 2,615 5/20/2022
1.4.5 12,668 3/20/2022
1.4.4 48,629 9/25/2021
1.4.3 8,341 7/9/2021
1.4.2 220 7/9/2021
1.4.1 10,745 5/19/2021
1.4.0 82,983 12/30/2020
1.3.0 1,243 12/24/2020
1.2.0 417 12/24/2020
1.1.0 71,077 8/22/2020
1.0.8 48,698 3/17/2020
1.0.7 69,473 11/27/2018
1.0.6 6,326 9/1/2018
1.0.5 5,765 7/17/2018
1.0.2 874 7/10/2018
1.0.0 8,268 12/22/2017