The requested page is not available for the requested platform. You are viewing the content for Default platform.

UPC-E0

Short Description

UPC-E is a variation of UPC-A which allows for a more compact bar code by eliminating "extra" zeros. Since the resulting UPC-E bar code is about half the size as an UPC-A bar code, UPC-E is generally used on products with very small packaging, where a full UPC-A bar code could not reasonably fit.

The UPC-E0 is a kind of UPC-E code with the number system set to 0. In the human readable string of the bar code the first digit signifies the number system (always 0 for this code type), and the last digit is the check digit of the original UPC-A code.

In the example below, the original UPC-A code is "04210000526". We should remove the leading zero when assigning the string to the control's property, since the code format itself implies its presence. The checksum digit (4) is calculated automatically, and the symbology algorithm transforms the rest of the numeral string. The result is 425261, and it is encoded along with the number system prefix and the check digit into the scanner-readable form.

Barcode - UPC-E

Not every UPC-A code can be transformed into the UPC-E0. It must meet special requirements, and you should refer to UPC-E Symbology page for more information.

Bar Code Properties

The type of a bar code control's Symbology property is UPCE0Generator.

The are no properties specific to the UPC-E0 bar code type.

Note

If it is not possible to convert from the 10-digit code to the six-digit code, the "Invalid text format" string is displayed. The digits to the right of the 10th digit in the code string are ignored. It is the developer's responsibility to verify the correctness and the length of the string.

Examples

The following code creates a UPC-E0 bar code and specifies its main properties.

using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateUPCE0BarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to UPC-E0.
    barCode.Symbology = new UPCE0Generator();

    // Adjust the bar code's main properties.
    barCode.Text = BarCodeText;
    barCode.Width = 400;
    barCode.Height = 100;

    return barCode;
}

To add the XRBarCode to a report band, handle the report's XRControl.BeforePrint event.

using System.Drawing.Printing;
// ...

private void XtraReport1_BeforePrint(object sender, PrintEventArgs e) {
    this.Detail.Controls.Add(CreateUPCE0BarCode("012345678"));
}