Royalty-free developer license, one time purchase for lifetime use
UPC-E Barcode Introduction
UPC-E is also known as Universal Product Code version E, UPC-E Supplement 5/Five-digit Add-On, UPC-E Supplement 2/Two-digit Add-On, UPC-E+5, UPC-E+2, UPC-E0, E0, UPC-E1, E1, GTIN-12 with lead "0", GS1-12, UCC-12.
UPC-E is a variation of UPC-A which allows for a more compact barcode by eliminating "extra" zeros. Since the resulting UPC-E barcode is about half the size as an UPC-A barcode, UPC-E is generally used on products with very small packaging where a full UPC-A barcode couldn't reasonably fit. A UPC-E barcode represents 6 digits with an implied number system 0.
Sample of a UPC-E Barcode with Data property = "123450".
The data displayed by UPC-E barcode image has the following structure:
1 digit for Number System (0), set by library automatically.
6 digits for UPCE data set through Data property
1 digit for checksum, calculated automatically by barcode library.
Add-On or Supplement code
The Add-On Symbols were designed to encode information supplementary to that in the main bar code symbol on periodicals and paperback books. The Add-On can be composed of 2 or 5 digits only.
Sample of an UPC-E Two-Digit Add-On Barcode
Sample of an UPC-E Five-Digit Add-On Barcode
UPC-E Encoding Data Scope
UPCE Barcode for Java supports:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
How to Generate UPC-E Barcode in Java Class?
The following Java code illustrates how to create a UPC-E barcode, and output to various formats.
1 Linear linear = new Linear(); 2 linear.setType(Linear.UPCE); 3 linear.setData("123450"); 4 linear.renderBarcode("c:/barcode.gif");
Under java_barcode_trial package, copy barcode folder to your java servlet container like tomcat.
Restart tomcat. Now you have installed successfully.
To test your installation, open your web browser and navigate to: http://YourDomain:Port/barcode/linear?Data=123450&Type=UPCE
To create barcode image in your JSP or html page, you need pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/linear?Data=123450&Type=UPCE" /> Using this method, it will not generate any barcode images in your server side.
The second method is to generate barcode images in your server side.
Create a barcode image in server side, like Linear linear = new Linear(); linear.setData("123450"); linear.setType(Linear.UPCE); linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/barcode-images/barcode.gif");
In your JSP or HTML page, you need use IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/barcode-images/barcode.gif" />
How to Generate Barcode UPC-E Image in Jasper Reports, iReport, Eclipse BIRT?
Set the type property to Linear.UPCE, or Linear.UPCE_2, or Linear.UPCE_5 Servlet URL Parameter: "Type". Value: 43 (UPCE), 44 (UPCE +2), 45 (UPCE +5). Sample: &Type=43.
Set the data property with the value to encode. Type is String. Servlet URL Parameter: Data.
Valid Data Scope:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Valid Data Format:6 digits. DO NOT include the first digit (the UPCE number system) and the last digit (the checksum character).
Sample: "123456".
Set the sData property with the supplement value to encode. Type is String. User should only provide 2 digits for UPCE_2, and provide only 5 digits for UPCE_5. Servlet URL Parameter: SData.
addCheckSum property is not applied here. Barcode Library will always add a check character in the last digit (modulo 10). The UPC-E check digit has the same value of the check digit on the equivalent UPC-A number.
Set upceNumber property. UPCE number system. Default is 0. Valid values are: 0 or 1. Servlet URL Parameter: UPCENumber. Sample: &UPCENumber=0.
Barcode image size settings.
Set property uom (Unit of Measure) for properties X, Y, leftMargin, rightMargin, topMargin and bottomMargin. Default is Linear.UOM_PIXEL (0). Valid values are Linear.UOM_PIXEL (0), Linear.UOM_CM (1), Linear.UOM_Inch (2). Servlet URL Parameter: "UOM". Value: 0 (pixel), 1 (cm), 2 (inch). Sample: &UOM=0.
Set the X (for barcode module width) and Y (for barcode module height) properties. Both types are float. Default X is 3. Y is 75. Servlet URL Parameter: "X", "Y". Sample: &X=3&Y=75.
Set the leftMargin, rightMargin, topMargin and bottomMargin properties, and types are all float. Default values are 0 for all 4 margin settings. Servlet URL Parameter: "LeftMargin", "RightMargin", "TopMargin", "BottomMargin". Sample: &LeftMargin=0.
Set the resolution property (Value is expressed in DPI - Dots per inch). Default is 72 dpi. Servlet URL Parameter: "Resolution". Sample: &Resolution=72.
Setting up text style in barcode image.
Set the showText properties. If this value is true, barcode data will be displayed with the barcode. Default is true. Servlet URL Parameter: "ShowText". Value: "t" (true), "f" (false). Sample: &ShowText=t.
Set the textFont property. The font used to display text in barcode image. Default is new Font("Arial", Font.PLAIN, 11). Servlet URL Parameter: "TextFont". Value format: [font name]|[font style]|[font size]. Sample Values: &TextFont=Arial|Bold|12
With rotate property, you can display barcode horizontally or vertically. Default value is 0. Servlet URL Parameter: "Rotate". Sample: &Rotate=0. Value can be: