IRONSOFTWAREHOME
Create Barcode
using IronBarCode;
using System.IO;

// Create a barcode with one line of code
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);

// Save the barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg");

// A barcode can also be made from binary data (byte or stream)
string payloadAsString = "This is some random string";

byte[] payloadAsByteArray = System.Text.Encoding.Default.GetBytes(payloadAsString); // Byte array
var AztecBarcode = BarcodeWriter.CreateBarcode(payloadAsByteArray, BarcodeWriterEncoding.Aztec, 400, 400); // Create from Byte array

MemoryStream payloadAsStream = new MemoryStream(payloadAsByteArray); // MemoryStream
var AztecBarcode2 = BarcodeWriter.CreateBarcode(payloadAsStream, BarcodeWriterEncoding.Aztec, 400, 400); // Create from memory stream
Imports IronBarCode
Imports System.IO

' Create a barcode with one line of code
Dim myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)

' Save the barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg")

' A barcode can also be made from binary data (byte or stream)
Dim payloadAsString As String = "This is some random string"

Dim payloadAsByteArray As Byte() = System.Text.Encoding.Default.GetBytes(payloadAsString) ' Byte array
Dim AztecBarcode = BarcodeWriter.CreateBarcode(payloadAsByteArray, BarcodeWriterEncoding.Aztec, 400, 400) ' Create from Byte array

Dim payloadAsStream As New MemoryStream(payloadAsByteArray) ' MemoryStream
Dim AztecBarcode2 = BarcodeWriter.CreateBarcode(payloadAsStream, BarcodeWriterEncoding.Aztec, 400, 400) ' Create from memory stream
NuGet Download
PM > Install-Package BarCode
Create Barcode

Create Barcode

IronBarcode offers many options and customizations when it comes to generating barcodes. Whether you're developing a standalone barcode generator to produce images with standard encoding formats like EAN8, Code128, and Code39, or need a flexible library to integrate barcode creation into your existing application using ByteArray or MemoryStream, IronBarcode provides an easy-to-use solution with extensive features, including exporting to standard image formats like png, jpg, and jpeg.

BarcodeWriter.CreateBarcode

After instantiating the BarcodeWriter class, we use BarcodeWriter.CreateBarcode to create a barcode. The method takes two required parameters: a string value and the BarcodeWriterEncoding enum chosen by the developer. We then save the barcode as an image for further use.

Besides creating a barcode, IronBarcode also allows developers to chain methods together for easier usage, as shown in line 3. It creates a barcode, then calls ResizeTo to resize the image given the height and width in pixels, ultimately saving the barcode as an image with SaveAsImage.

Furthermore, there are multiple variations of the BarcodeWriter.CreateBarcode method to cater to different situations and scenarios. If you need to create a barcode based on a ByteArray, we can use another variation of the same CreateBarcode method, pass in the ByteArray as the value, and specify the height and width of the barcode beforehand as well.

Similarly, if you need to create a barcode with a MemoryStream type variable, IronBarcode offers that as well; pass the MemoryStream variable as the first parameter in BarcodeWriter.CreateBarcode, similarly to how it is done above, and repeat the steps.

IronBarcode has all the options and scenarios prepared for developers looking to create simple barcode values, integrate them into their applications, and more!

Learn How to Create Custom Barcode Images
View on GitHub

Ready to Get Started?

Nuget Downloads 2,422,100Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required