Barcode generator API for C# and VB.NET

Aug 04, 2019

How to generate QR code and linear barcodes in C# and VB.NET?

We are pretty much surrounded by barcodes every day. For example, almost everything we purchased from a grocery store has a barcode on the package. When a patient is checked in, a wristband will be tied to the patient, with a barcode on it. There is a barcode (the type is PDF417, by the way) on the back of our driver’s license. Needless to say, these little bars and squares is becoming an important media for encoding information. So, how do we generate these bar codes?

Before going any further, let’s take a look at a simple sample.

Barcode generation sample

Below is a preview of the UI. If you want to get your hands dirty, you may download Dynamic .NET TWAIN.
30-day free trial download ->

After installation, you will find the sample under \Samples\C# Samples\BarcodeGenerator in the installation folder. The source code is available in C# and VB.NET.


This sample is developed with Dynamsoft Dynamic .NET TWAIN and its barcode add-on. With the barcode APIs, creating a barcode is pretty straightforward. At the core of this barcode generator is the AddBarcode() method. In the parameters, you can set which image the barcode is added to, the type and value string of the barcode, the human readable text which appears under the barcode image, the position and the size.

Code Snippet

dynamicDotNetTwain1.AddBarcode(dynamicDotNetTwain1.CurrentImageIndexInBuffer, barcodeformat, txtBarcodeContent.Text, txtHumanReadableTxt.Text, int.Parse(txtBarcodeLocationX.Text), int.Parse(txtBarocdeLocationY.Text), float.Parse(txtBarcodeScale.Text));

 .NET Barcode Generator Features

  • Supports drawing barcodes onto a local image or PDF file, or images captured from scanners and web cameras;
  • Supported Barcode Symbologies
    2D barcode
    QR code, DataMatrix, PDF417 (MicroPDF417 not supported), driver’s license

1D barcode
Code 39, Code 93, Code 128, Codabar, Interleaved 2 of 5, EAN-8, EAN-13 UPC-E, ITF (Interleaved 2 of 5), Industrial 2 of 5

  • Creates barcode images in Windows Forms and WPF applications;
  • Supports .NET framework 2.0 and 4.0.


The barcode SDK is licensed on a per developer basis. And royalty-free.

How to detect and read barcodes?

Dynamsoft also provides a barcode reader SDK, which has a detailed introduction here. If you have any question about barcodes or imaging, feel free to contact us at