Create Barcode
IronBarcode offers many options and customization 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 offers an easy-to-use solution with extensive features, including exporting to standard image formats like png
, jpg
, and jpeg
.
Barcode Generator in C#
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
myBarcode.SaveAsImage("EAN8.jpeg")
BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8).ResizeTo(400, 100).SaveAsImage("EAN8.jpeg")
var AztecBarcode = BarcodeWriter.CreateBarcode(payloadAsByteArray, BarcodeWriterEncoding.Aztec, 400, 400)
var AztecBarcode2 = BarcodeWriter.CreateBarcode(payloadAsStream, BarcodeWriterEncoding.Aztec, 400, 400)
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 that the developer chooses. We then save the barcode as an image for further use.
Other than 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 ByteArray,
we can use another variation of the same CreateBarcode
method, pass in 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!
Click here to view the How-to-Guide, including examples, sample code and files