Skip to footer content

How to Generate Barcode Images in C# for .NET using Iron Barcode

In this tutorial, learn how to generate barcode images using C# and the IronBarcode library. Begin by opening Visual Studio and accessing the package manager console. Install the barcode library using the command Install-Package Barcode. Once installed, navigate to the Program.cs file to write your code.

First, you need to import the IronBarcode namespace, which provides all the necessary classes and methods to create and manage barcodes. Use BarcodeWriter.CreateBarcode() to generate the barcode, specifying the text you wish to encode. In this example, the text is 'This is my first barcode by IronBarcode'. The encoding scheme used here is BarcodeEncoding.Code128. Finally, save the barcode as an image file. You can choose from formats like PNG, JPEG, and PDF. Here, we'll save it as 'barcode.png'.

Further Reading: Generate Barcode Images in C#

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he says it’s one of his favorite aspects of working with Iron Software. Jordi grew up in Miami, Florida and studied Computer Science and Statistics at University of Florida.