KA.Barcode for ASP.NET
How to Create & Resize UPC-A in ASP.NET
Complete ASP.NET source code to generate, print UPC-A images using Barcode Generator for .NET Control
  • Compatible with .NET Framework 2.0, 3.0, 3.5, 4.0 and above versions
  • Embedding dynamic linear & 2D barcodes, such as VB.NET ISBN, ISBN .NET, Data Matrix Word, VB.NET Interleaved 2 of 5, in your applications
  • Mature UPC-A Barcode Creator for easy barcodes integration into Microsoft Visual Studio
  • Generating, creating 1D UPC-A in ASP.NET webform/ websites & MS Internet Information Service (IIS)
  • Draw, generate UPC-A barcode with add-ons and adjust supplemental bar height and space
  • Support linear UPC-A creation and resizing of surrounding margin width
  • Provide cm, inch, and pixel as the unit of measure to resize generarted, printout UPC-A images
  • Insert linear and GS1 barcodes , such as ASP.NET EAN-13, PDF417 C#, ASP.NET PDF417, .NET WinForms Data Matrix, in your applications
  • Draw multiple UPC-A barcodes pictures into BMP/Bitmap, Jpeg, Png, and Tiff and save to local files
  • Accurate UPC-A barcode generation in ASP.NET in accordance with GS1 standard
UPC-A Barcode Generator Software Plugin for ASP.NET provides an easy way to create GS1 compatible UPC-A, UPC-A Sup2 and UPC-ASup5 barcodes in ASP.NET web pages/ webform, IIS with resized barcode margin, adjusted supplemental bar height & space, flexible X, Y dimension, etc. Here are samples to resize UPC-A barcode image in ASP.NET, IIS; you may find UPC-A barcode data and image related tutorials here:
UPC-A 1D Bar Code Structure
UPC-A
UPC-A barcode (a.k.a Universal Product Code version A) is constructed of:
  • Left Quiet Zone
  • The number System
  • The manufacturer code
  • The product code
  • The check digit
  • Right Quiet Zone
UPC-A Size Setting with C#, VB.NET Class in ASP.NET

Install UPC-A Barcode Creator Component into ASP.NET Projects

  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 free C#/ VB.NET barcode syntax onto you forms to produce, string a UPC-A in ASP.NET web pages/ website:
using KeepAutomation.Barcode.Bean;
BarCode barcode= new BarCode();
barcode.Symbology= KeepAutomation.Barcode.Symbology.UPCA;
barcode.CodeToEncode = "12345678901";
barcode.generateBarcodeToImageFile("C://barcode-upca-csharp.gif");
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

barcode.Symbology= KeepAutomation.Barcode.Symbology. UPCA
barcode.CodeToEncode = "12345678901"
barcode.generateBarcodeToImageFile("C://barcode-upca-vbnet.gif")

Creating UPC-A Barcode with Pixel as Unit of Measure

BarcodeUnit (URL: barcode-unit; Default: Pixel): it is the unit measurement for all size related settings in UPC-A 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

Adding EAN-2 & EAN-5 Barcodes as Supplement for UPC-A 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 UPC-A symbol and supplementary symbol EAN-2 or EAN-5.
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCASup2;
barcode.SupplementCode = "12";
barcode.SupplementHeight = 0.7;
barcode.SupplementSpace = 20;
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCASup2
barcode.SupplementCode = "12"
barcode.SupplementHeight = 0.7
barcode.SupplementSpace = 20

Drawing UPC-A with Specified X and Y Dimension

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

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

Generating UPC-A with Fixed BarCodeWidth and BarCodeHeight

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

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

Creating UPC-A with Specific Quiet Margin

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

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

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

RightMargin (URL: right-margin; Default: 0): it is the barcode image right margin in UPC-A 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
UPC-A 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 "UPCASup2" 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.
    A UPC-ASup2 barcodes with different customized size occurs
UPC-A 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.
    Restart IIS and now you have successfully installed the ASP.NET Barcode Generator web application
  4. 4.
    To test it, open your web browser, and navigate to "http://localhost/barcode/barcode.aspx?symbology=40&code-to-encode=01234567890&barcode-unit=0&supplement-code=12&supplement-height=0.7f&supplement-space=20&x=3&y=75&barcode-width=200&barcode-height=75&top-margin=8&bottom-margin=8&left-margin=6&right-margin=6"
  5. 5.
    A UPC-A barcode with customized size occurs will be displayed