Crystal Reports Barcode Generator
UPC-A Barcode Generation in Crystal Reports
How to Create UPC-A Barcode in Crystal Reports Using C# or VB Demo
- Advanced and powerful UPC-A barcode generation control for Crystal Reports
- Completely developed in C#.NET and compatible with any .NET Framework environment
- Generate and print UPC-A images in Visual C# and Visual Basic .NET
- Easy to print scannable & readable UPC-A barcode images for Crystal Reports in no time
- Able to customize UPC-A parameters, like SupplementCode, SupplementHeight & SupplementSpace
- Display UPC-A in Gif, Tiff, Bmp, Png and Jpeg images or as graphic objects
- Automatically calculate and add checksum character for UPC-A barcode
Introduction of Crystal Reports UPC-A Barcode Control
KA.Barcode Generator for Crystal Reports is an easy-to-use and robust barcode generation component that allows developers to quickly and easily add barcode generation and printing functionality in Crystal Reports. The generated barcodes strictly conform to related barcode standards and barcode specifications.
Description of UPC-A Barcode
UPC stands for Universal Product Code. UPC-A is the most common form of UPC codes that consists of 12 digits to encode goods sold at point-of-sale in North America.
UPC-A Encodable Characters
- UPC-A Encodable Characters: numeric digits 0-9
- UPC-A Structure: 1 digit for Number System, 5 digits for Manufacturer Code, 5 digits for Product Code and 1 digit for checksum that will be automatically added by our software
Download of Crystal Reports UPC-A Barcode Control
- User Manual and Order Page
- End User License Agreement
- KeepAutomation.Barcode.Crystal.dll
- KACrystalData.mdb
- ProductDataSet.xsd
Users are allowed to use this Crystal Reports UPC-A Barcode Library Evaluation to generate advanced and professional UPC-A barcode image without time limitation. But users need to buy our applicable license for business applications because barcode image generated with the trial version will include a "KA Barcode" watermark randomly. Generation of Crystal Reports UPC-A Barcode in ASP.NET
- Create a new web project with "ASP.NET Crystal Reports Web Site" as template in your Visual Studio.
- Establish a new report "Using the Report Wizard", choose "Standard", and click "OK".
- In "Data" form, double click "Create New Connection", and expand "ADO.NET".
- Add "ProductDataSet.xsd" file in "ADO.NET" form, and click "Finish" button.
- In "Data" form, add table "Product" and click "Next".
- In "Fields" form, add all three columns in the table "Product" and click "Finish".
- Add field "Barcode" to the report Section 3 in CrystalReport1.rpt.
- Locate reference "KeepAutomation.Barcode.Crystal.dll" to your project.
- Use the sample codes below and run your project.
C# Sample code
protected void Page_Load(object sender, EventArgs e) { OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb"); aConnection.Open(); OleDbDataAdapter dataAdapter = new OleDbDataAdapter("select * from Product",aConnection); DataSet ds = new DataSet(); dataAdapter.Fill(ds); //Add the Barcode column to the DataSet ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[]))); BarCode upca = new BarCode(); //Barcode settings upca.Symbology = KeepAutomation.Barcode.Symbology.UPCA; upca.ImageFormat = System.Drawing.Imaging.ImageFormat.Png; foreach (DataRow dr in ds.Tables[0].Rows) { upca.CodeToEncode = (int)dr["ProductId"] + ""; byte[] imageData = upca.generateBarcodeToByteArray(); dr["Barcode"] = imageData; } CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt")); CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]); CrystalReportSource1.DataBind();
} VB Sample code
Protected Sub Page_Load(sender As Object, e As EventArgs) Dim aConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb") aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Product", aConnection) Dim ds As New DataSet() dataAdapter.Fill(ds)
'Add the Barcode column to the DataSet ds.Tables(0).Columns.Add(New DataColumn("Barcode", GetType(Byte())))
Dim upca As New BarCode() 'Barcode settings upca.Symbology = KeepAutomation.Barcode.Symbology.UPCA upca.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
For Each dr As DataRow In ds.Tables(0).Rows upca.CodeToEncode = CInt(dr("ProductId")) & "" Dim imageData As Byte() = upca.generateBarcodeToByteArray() dr("Barcode") = imageData Next CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt")) CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0)) CrystalReportSource1.DataBind()
End Sub
View this detailed guide to generate UPC-A barcode image in .NET WinForms with this Crystal Reports Barcode Control. Free C# and VB sample codes are also provided. Properties of UPC-A Barcode |