NetBarcode 2.0.0-beta.1

This is a prerelease version of NetBarcode.
dotnet add package NetBarcode --version 2.0.0-beta.1
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.
<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 and Polyglot Notebooks. 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 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 was computed.  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. 
.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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 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

Kurumin.Core

Colletion libraries for Kurumin Solutions

SktPublicLibrary

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on NetBarcode:

Repository Stars
ZeusAutomacao/DFe.NET
Biblioteca para Geração de NFe(2.0, 3.10 e 4.0) e NFCe(3.10 e 4.0) e consumo dos serviços necessários à sua manutenção, conforme descritos em http://www.nfe.fazenda.gov.br/portal/principal.aspx
Version Downloads Last updated
2.0.0-beta.1 9,618 7/12/2021
1.7.1.1 1,125 4/18/2024
1.7.0 357,703 7/22/2022
1.6.0 4,782 6/20/2022
1.5.2 1,462 6/16/2022
1.5.0 8,732 5/20/2022
1.4.5 63,837 3/20/2022
1.4.4 124,367 9/25/2021
1.4.3 11,303 7/9/2021
1.4.2 402 7/9/2021
1.4.1 17,046 5/19/2021
1.4.0 136,614 12/30/2020
1.3.0 1,560 12/24/2020
1.2.0 684 12/24/2020
1.1.0 105,159 8/22/2020
1.0.8 78,720 3/17/2020
1.0.7 90,042 11/27/2018
1.0.6 6,683 9/1/2018
1.0.5 6,251 7/17/2018
1.0.2 1,163 7/10/2018
1.0.0 8,664 12/22/2017