KA.Barcode for ASP.NET
How to Create & Resize EAN-13 in ASP.NET
Complete ASP.NET source code to generate, print EAN-13 using Barcode Generator for ASP.NET Control
  • User-defined EAN-13 linear barcode creation SDK for ASP.NET
  • Work perfectly with ASP.NET Web forms, Microsoft Internet Information Services (IIS)
  • Provide barcode SDK for implementing barcodes as you wish, like EAN 128 .NET WinForms, EAN-8 VB.NET, Data Matrix ASP.NET, Intelligent Mail Excel, etc.
  • Export EAN-13 1D barcodes into GIF, BMP, PNG, JPEG, and TIFF without any distortion
  • Drawing, creating adjustable supplemental barcode add-on for EAN-13+2, EAN-13+5 in ASP.NET web pages
  • Integrate flexible EAN-13 barcode sizing features into ASP.NET webform/ website
  • Completely support adjusting EAN-13 width and height of module bar
  • Adjust the width and height of the printout EAN-13 image in ASP.NET
  • Insert linear and GS1 barcodes , such as UPC-E .NET WinForms, ITF-14 Excel, UPC-E VB.NET, ITF-14 Word, in your applications
  • Capable of drawing, creating EAN-13 1D barcode image with minimum X to save space
EAN-13 Barcode Generator for ASP.NET is a mature and easy-to-use barcode creator control addin for creating, generating EAN-13, EAN-13Sup2 and EAN-13Sup5 barcodes in ASP.NET webforms and web pages. With this encoder, users may easily generate multiple EAN-13 barcodes with various sizes. This page explains how to resize EAN-13 barcodes in ASP.NET, IIS. Other tutorials for EAN-13 data encoding and image setting are provided here:
EAN-13 Bar Code Structure
EAN-13
EAN-13 barcode (a.k.a European Article Number 13, EAN/UCC-13, GS1-13, GTIN-13) is constructed of:
  • Left Quiet Zone
  • The number System
  • The manufacturer code
  • The product code
  • The check digit
  • Right Quiet Zone
EAN-13 Size Setting with C#, VB.NET Class in ASP.NET

Install EAN-13 Barcode Creator Component into ASP.NET Project

  1. 1.
  2. 2.
    Add reference: Add "KeepAutomation.Barcode.Web.dll" to your ASP.NET project reference
  3. 3.
    Add to toolbox: To add BarcodeControl to your ASP.NET toolbox
Copy the C# or VB.NET barcode syntax onto you program to stream, produce EAN-13 in ASP.NET website:
using KeepAutomation.Barcode.Bean;
BarCode barcode= new BarCode();
barcode.Symbology= KeepAutomation.Barcode.Symbology.EAN13;
barcode.CodeToEncode = "012345678901";
barcode.generateBarcodeToImageFile("C://barcode-ean13-csharp.gif");
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

barcode.Symbology= KeepAutomation.Barcode.Symbology.EAN13
barcode.CodeToEncode = "012345678901"
barcode.generateBarcodeToImageFile("C://barcode-ean13-vbnet.gif")

Generating EAN-13 Barcode with Pixel as Unit of Measure

BarcodeUnit (URL: barcode-unit; Default: Pixel): it is the unit measurement for all size related settings in EAN-13 barcodes. User may change it with "Pixel", "Inch" and "Cm". Replace sample code with following one:
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel;
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel

Creating EAN-2 & EAN-5 Barcodes with Supplement Barcode

Symbology (URL: symbology; Default: Code128Auto): it is used for changing barcode types.

SupplementCode(URL: supplement-code; Default: ""): it is used for encoding supplementary data.

SupplementHeight (URL: supplement-height; Default: 0.8f): it is the height of bar in supplementary symbol EAN-2 or EAN-5.

SupplementSpace (URL: supplement-space; Default: 15): it is used for changing space between EAN-13 symbol and supplementary symbol EAN-2 or EAN-5.
barcode.Symbology = KeepAutomation.Barcode.Symbology.EAN13Sup2;
barcode.SupplementCode = "12";
barcode.SupplementHeight = 0.7;
barcode.SupplementSpace = 20;
barcode.Symbology = KeepAutomation.Barcode.Symbology.EAN13Sup2
barcode.SupplementCode = "12"
barcode.SupplementHeight = 0.7
barcode.SupplementSpace = 20

Printing EAN-13 with Specific X and Y (Bar Width & Height)

X (URL: x; Default: 1): it is the width of the narrow bar in EAN-13 barcodes.

Y (URL: y; Default: 50): it is the height of bars in EAN-13 barcodes.
barcode.X = 3;
barcode.Y = 75;
barcode.X = 3
barcode.Y = 75

Streaming EAN-13 with Fixed BarCodeWidth and BarCodeHeight

BarCodeWidth (URL: barcode-width; Default: 0): it is the barcode width of EAN-13 barcodes.

BarCodeHeight (URL: barcode-height; Default: 0): it is the barcode height of EAN-13 barcodes.
barcode.BarCodeWidth = 200;
barcode.BarCodeHeight = 75;
barcode.BarCodeWidth = 200
barcode.BarCodeHeight = 75

Drawing EAN-13 with Quiet Zones/ Surrounding Margins

TopMargin (URL: top-margin; Default: 0): it is the barcode image top margin in EAN-13 barcodes.

BottomMargin (URL: bottom-margin; Default: 0): it is the barcode image bottom margin in EAN-13 barcodes.

LeftMargin (URL: left-margin; Default: 0): it is the barcode image left margin in EAN-13 barcodes.

RightMargin (URL: right-margin; Default: 0): it is the barcode image right margin in EAN-13 barcodes.
barcode.TopMargin = 8;
barcode.BottomMargin = 8;
barcode.LeftMargin = 6;
barcode.RightMargin = 6;
barcode.TopMargin = 8
barcode.BottomMargin = 8
barcode.LeftMargin = 6
barcode.RightMargin = 6
EAN-13 Size Setting with Drag & Drop BarcodeControl
  1. 1.
    In "Choose Toolbox Items" form, click button "Browse...", and select KeepAutomation.Barcode.Web.dll
  2. 2.
    Now you'll see BarCodeControl in your toolbox
  3. 3.
    Drag and drop the BarCodeControl into the Forms and a Codabar image is generated
  4. 4.
    Find barcode setting panel, choose "Symbology" to "EAN13Sup2" and write down encode data
  5. 5.
    Set "BarcodeUnit" to "Pixel", and encode "12" in "SupplementCode"
  6. 6.
    Set "SupplementHeight" to 0.7 and "SupplementSpace" to 20
  7. 7.
    Set "X" to 3, "Y" to 72; Set "BarcodeWidth" to 200 and "BarcodeHeight" to 75
  8. 8.
    Set "TopMargin" & "BottomMargin" to 8; and set "RightMarign" & "LeftMargin" to 6
  9. 9.
    An EAN-13Sup2 barcodes with different customized size occurs
EAN-13 Size Setting in Internet Information Service (IIS)
  1. 1.
    Copy folder "barcode" in your download the trial package to your IIS web application folder
  2. 2.
    Create a virtual directory, named "barcode", and link to your just copied "barcode" folder
  3. 3.

    To test it, open your web browser, and navigate to "http://localhost/barcode/barcode.aspx?symbology=16&code-to-encode=012345678901&barcode-unit=0&supplement-code=12&supplement-height=0.7f&supplement-space=20&barcode-height=75&top-margin=8&bottom-margin=8&left-margin=6&right-margin=6"
  4. 4.
    An EAN-13 barcode with customized size occurs will be displayed