For Using BC.NetBarcodeGenerator.All2D
Generate and save 2d barcodes to raster image files, Stream, Bitmap, Graphics, and HttpResponse in .NET, C#, VB.NET applications.
It's easy to use BC.NetBarcodeGenerator.All2D library to generate and save 2d/matrix barcode symbologies in your .NET/C#/VB.NET Class, Console Application, .NET Windows Forms, and ASP.NET web projects. Please firstly download and get the free trial library of BC.NetBarcodeGenerator.All2D. And the only thing for integration is to add your project reference to the library dll.
Support QR Code, Data Matrix, and PDF417 barcode symbologies.
PLEASE NOTE, BC.NetBarcodeGenerator.All2D package only supports 2d barcode symbologies (QR Code, Data Matrix & PDF417) generation for .NET applications. To generate all linear/1d and 2d barcode symbologies, you should use BC.NetBarcodeGenerator.All SDK package.
On this page, we provide C# and VB.NET Class coding examples of how to use BC.NetBarcodeGenerator.All2D library to generate 2d barcodes (QR Code, Data Matrix & PDF417) to a local raster image file and Bitmap object. In addition, you can also output 2d barcodes to Stream, Graphics, and HttpResponse in .NET applications.
In addition to barcodes generation in .NET/C#/VB.NET Class, you can also generate 2D barcodes in .NET Windows Forms, ASP.NET Web Forms, and IIS applications in other ways. Please click to see details. Moreover, ASP.NET web project and .NET Windows Forms project demos are included in our free trial package. Please download a free trial to see more.
1. This section shows how to generate 2d barcode QR Code/Data Matrix/PDF417 to a local raster image file on your disk in ASP.NET C# and VB.NET Class. Jpg, Jpeg, Tiff, Png, Bmp, and Gif formats are supported. Please firstly add your ASP.NET project reference to BC.NetBarcodeGeneratorTrial.All2D.dll.
using System; using System.Drawing; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BC.AspNetBarcodeGeneratorTrial.All2D; namespace BCAspNetBarcodeGeneratorDemo { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Qrcode barcode = new Qrcode(); barcode.SetData = "WWW.BARCODEBC.COM"; barcode.SetUOM = UnitofMeasurement.Pixel; barcode.SetRotation = Rotation.RotateDown; barcode.SetDPI = 96; barcode.ApplyTilde = true; barcode.AutoSize = false; barcode.SetModuleSize = 3; barcode.SetModuleColor = System.Drawing.Color.DeepPink; barcode.SetEncodingMode = QrcodeEncodingMode.Automatic; barcode.ApplyStructuredAppend = false; barcode.SetECI = 3; barcode.SetECL = QrcodeECL.LevelL; barcode.SetFNC1 = QrcodeFNC1.None; barcode.SetQrcodeVersion = QrcodeVersion.Version1; barcode.StructuredAppendCount = 0; barcode.StructuredAppendIndex = 0; barcode.SetLeftSpace = 5; barcode.SetRightSpace = 5; barcode.SetTopSpace = 5; barcode.SetBottomSpace = 5; barcode.SetWidth = 80; barcode.SetHeight = 80; barcode.GenerateBarcode("F://test.png"); //In addition to String, you can also output barcode to a Bitmap object, Stream object, Graphics object, HttpResponse object or byte array. } } }
Imports System Imports System.Drawing Imports System.Collections.Generic Imports System.Linq Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports BC.AspNetBarcodeGeneratorTrial.All2D Public Partial Class _Default Inherits Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Dim barcode As Qrcode = New Qrcode() barcode.SetData = "WWW.BARCODEBC.COM" barcode.SetUOM = UnitofMeasurement.Pixel barcode.SetRotation = Rotation.RotateDown barcode.SetDPI = 96 barcode.ApplyTilde = True barcode.AutoSize = False barcode.SetModuleSize = 3 barcode.SetModuleColor = System.Drawing.Color.DeepPink barcode.SetEncodingMode = QrcodeEncodingMode.Automatic barcode.ApplyStructuredAppend = False barcode.SetECI = 3 barcode.SetECL = QrcodeECL.LevelL barcode.SetFNC1 = QrcodeFNC1.None barcode.SetQrcodeVersion = QrcodeVersion.Version1 barcode.StructuredAppendCount = 0 barcode.StructuredAppendIndex = 0 barcode.SetLeftSpace = 5 barcode.SetRightSpace = 5 barcode.SetTopSpace = 5 barcode.SetBottomSpace = 5 barcode.SetWidth = 80 barcode.SetHeight = 80 barcode.GenerateBarcode("F://test.png") ‘In addition to String, you can also output barcode to a Bitmap object, Stream object, Graphics object, HttpResponse object or byte array. End Sub End Class
2. These .NET Class coding examples show how to load an image and generate 2d barcode symbology QR Code/Data Matrix/PDF417 on it in .NET WinForms application. Please firstly add your .NET WinForms project reference to BC.NetBarcodeGeneratorTrial.All2D.dll. All barcodes properties reference is provided here.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BC.NetWinBarcodeGeneratorTrial.All2D; namespace BCNetWinBarcodeGeneratorDemo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Datamatrix barcode = new Datamatrix(); barcode.SetData = "246810013579"; barcode.SetUOM = UnitofMeasurement.Pixel; barcode.SetRotation = Rotation.RotateDown; barcode.ApplyTilde = false; barcode.SetDatamatrixFormat = DatamatrixFormat.Format16X16; barcode.SetEncodingMode = DatamatrixEncodingMode.ASCII; barcode.SetModuleColor = System.Drawing.Color.Red; barcode.SetFNC1 = DatamatrixFNC1.None; barcode.AutoSize = false; barcode.SetModuleSize = 5; barcode.SetDPI = 300; barcode.SetLeftSpace = 5; barcode.SetRightSpace = 5; barcode.SetTopSpace = 5; barcode.SetBottomSpace = 5; barcode.SetWidth = 80; barcode.SetHeight = 80; barcode.SetImageFormat = System.Drawing.Imaging.ImageFormat.Png; Image image = barcode.GenerateBarcode(); pictureBox1.Image = image; //In addition to Bitmap object, you can also output barcode to a String, Stream object, Graphics object or byte array. } private void Form1_Load(object sender, EventArgs e) { } } }
Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Linq Imports System.Text Imports System.Windows.Forms Imports BC.NetWinBarcodeGeneratorTrial.All2D Public Class BCNetWinBarcodeGeneratorDemo Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Dim barcode As Pdf417 = New Pdf417() barcode.SetData = "WWW.BARCODEBC.COM" barcode.SetUOM = UnitofMeasurement.Pixel barcode.SetRotation = Rotation.RotateDown barcode.SetDPI = 96 barcode.ApplyTilde = True barcode.AutoSize = False barcode.Pdf417Compact = False barcode.SetModuleColor = System.Drawing.Color.DeepPink barcode.SetEncodingMode = Pdf417EncodingMode.Text barcode.SetRows = 4 barcode.SetColumns = 5 barcode.SetECL = Pdf417ECL.Level2 barcode.SetLeftSpace = 5 barcode.SetRightSpace = 5 barcode.SetTopSpace = 5 barcode.SetBottomSpace = 5 barcode.SetWidth = 80 barcode.SetHeight = 80 barcode.SetX = 2 barcode.SetXRatio = 0.33F barcode.SetImageFormat = System.Drawing.Imaging.ImageFormat.Png Dim image As Image = barcode.GenerateBarcode() pictureBox1.Image = image ‘In addition to Bitmap object, you can also output barcode to a String, Stream object, Graphics object or byte array. End Sub End Class