QR Code Image Sample - pqScan.com
C#, VB.NET EAN-13 Creator Encoding EAN-13 Barcode Image in C# and VB.NET Online Demo Download Trial Purchase Now

How to Generate EAN-13 in C# and VB.NET

back to home  >  .NET Barcode Generator SDK  >  Generate Barcodes in C# & VB.NET  >  Generate EAN-13 in C# & VB.NET

C# and VB.NET EAN-13 Creator is one of the generation functions in pqScan Barcode Creator for .NET. It allows developers to use C Sharp and VB.NET language to generate EAN-13 in any .NET programming, such as printing EAN-13 in .NET Winforms and creating EAN-13 in ASP.NET web sites.

In this tutorial, we will introduce you how to generate EAN-13 using C#/VB.NET code in Console application.

Generate and make EAN-13 - C Sharp sample

With the flexible methods and rich properties, there is no difficult to encode EAN-13 barcode for you.

Add following C# code to your .NET project, a perfect EAN-13 barcode image is coming to you.

using System;
using System.Drawing;
using System.Drawing.Imaging;
usingPQScan.BarcodeCreator;

namespaceEAN13GeneratorInCSharp
{
    classProgram
    {
        staticvoid Main(string[] args)
        {

            //Create an instance of PQScan.BarcodeCreator.Barcodeobject.
            Barcode ean13 = new Barcode();
            //Set barcode date to encode
            ean13.Data = "12345678901";
            //Set barcode type
            ean13.BarType = BarCodeType.EAN13;
            //Set barcode image width
            ean13.Width = 200;
            //Set barcode image height
            ean13.Height = 100;
            //Set 1d barcode human-readable text to display
            ean13.ShowText = true;           
            //Set barcode image foregroud color
            ean13.BarcodeColor = Color.Black;
            //Set barcode image back ground color
            ean13.BackgroundColor = Color.White;
            //Set barcode image format
            ean13.PictureFormat = ImageFormat.Tiff;
            //Save barcode image to file
            ean13.CreateBarcode("ean13-csharp.tiff"); 
        }
    }
}

Create and render EAN-13 - Visual Basic sample

Besides using C# code, developers can also use VB.NET code to generate EAN-13 barcode image. Look at the code below, it may help you.

Imports System.Drawing
Imports System.Drawing.Imaging
Imports PQScan.BarcodeCreator

Namespace EAN13GeneratorInVB
    Class Program
        Private Shared Sub Main(args As String())

            'Create an instance of PQScan.BarcodeCreator.Barcode object.
            Dim ean13 As New Barcode()
            'Set barcode date to encode
            ean13.Data = "12345678901"
            'Set barcode type
            ean13.BarType = BarCodeType.EAN13
            'Set barcode image width
            ean13.Width = 200
            'Set barcode image height
            ean13.Height = 100
            'Set 1d barcode human-readable text to display
            ean13.ShowText = True
            'Set barcode image foregroud color
            ean13.BarcodeColor = Color.Black
            'Set barcode image back ground color
            ean13.BackgroundColor = Color.White
            'Set barcode image format
            ean13.PictureFormat = ImageFormat.Tiff
            'Save barcode image to file
            ean13.CreateBarcode("ean13-vb.tiff")
        End Sub
    End Class
End Namespace

generate ean13 in c#/vb.net

.NET Barcode Creator QR Code Creator in C#/VB Data Matrix Creator in C#/VB PDF 417 Creator in C#/VB Aztec Creator in C#/VB EAN 8 Creator in C#/VB UPC A Creator in C#/VB Code 128 Creator in C#/VB Code 39 Creator in C#/VB