It is also known as European
Article Number 13, EAN-13 Supplement 5/Five-digit Add-On, EAN-13 Supplement
2/Two-digit Add-On, EAN-13+5, EAN-13+2, EAN13, EAN13+5, EAN13+2, UPC-13,
GTIN-13, GS1-13, EAN/UCC-13
A European Article Number (EAN) is a barcoding standard which is a superset of the original 12-digit Universal Product Code (UPC) system developed in North America. The EAN-13 barcode is defined by the standards organisation GS1. It is also called a Japanese Article Number (JAN) in Japan. UPC, EAN, and JAN numbers are collectively called Global Trade Item Numbers (GTIN), though they can be expressed in different types of barcodes.
The EAN-13 barcodes are used worldwide for marking retail goods. The less commonly used EAN-8 barcodes are used also for marking retail goods; however, they are usually reserved for smaller items, for example confectionery.
Sample of an EAN-13 Barcode
The value to encode by EAN-13 has the following structure:
2 or 3 digits for Number System or Country Code
5 or 4 digits for Manufacturer (Company) Code or prefix
5 digits for Product Code
1 digit for checksum
Each country has a numbering authority which assigns
manufacturer codes to companies within its jurisdiction.
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.
There are two ways to create barcode images in your Java web applications.
This is the simplest way to stream barcode image using our provided barcode servlet classes.
And it will not save barcode images in your server side.
Under demo package, copy barcode folder to your java servlet container like tomcat.
To test your installation, goto http://YourDomain:Port/barcode/linear?Data=123456789012&Type=EAN13
To create barcode image in your JSP or html page, you can pass the url to IMG tag src value.
For example, <img src="http://YourDomain:Port/barcode/linear?Data=123456789012&Type=EAN13" />
The second method is similar with the way to generate barcode in Java applications.
Create a barcode image in server side
1 Linear linear = new Linear();
2 linear.setData("123456789012");
3 linear.setType(Linear.EAN13);
4 linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/bimages/barcode.gif");
In your JSP page, you can using IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/bimages/barcode.gif" />
Set the type property to Linear.EAN13 or Linear.EAN13_2 or Linear.EAN13_5 Servlet Parameter: "Type".
Set the data property with the value to encode. Type is string.
Servlet Parameter: "Data".
Set the sData property with the supplementary data to encode. Type is string.
Servlet Parameter: "SData".
Setting up barcode image size:
Set property uom (Unit of Measure) for properties barWidth, barHeight, 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 Parameter: "UOM".
Set the X (for barcode module width) and Y (for barcode module height) properties. Both types are float.
Servlet Parameter: "X", "Y".
Set the leftMargin, rightMargin, topMargin and bottomMargin properties, and types are all float.
Servlet Parameter: "LeftMargin", "RightMargin", "TopMargin", "BottomMargin".
Set the barcodeWidth (barcode image width) and barcodeHeight (barcode image height) properties. Both types are float.
Servlet Parameter: "BarcodeWidth", "BarcodeHeight".
Set the resolution property (Value is expressed in DPI - Dots per inch).
Servlet Parameter: "Resolution".
Setting up text style in barcode image:
Set the showText properties. If this value is true, barcode data will be displayed with the barcode.
Servlet Parameter: "ShowText".
Set the textFont property. The font used to display text in barcode image.
Servlet Parameter: "TextFont".
Set bearerBars property, if you want to draw borders around barcode image. Value can be Linear.BEARERBAR_UNSPECIFIED (-1. let library decide whether draw bear bars or not), Linear.BEARERBAR_NONE (0. no bear bars), Linear.BEARERBAR_FRAME (1. top, bottom, left, right borders drawn), Linear.BEARERBAR_TOPBOTTOM (2. only top, bottom's are drawn).
Servlet Parameter: "BearerBars".
Set rotate property, if you want to rotate barcode image.
Value can be 0 (Linear.ANGLE_0),
1 (Linear.ANGLE_90),
2 (Linear.ANGLE_180),
3 (Linear.ANGLE_270)
Servlet Parameter: "Rotate".
addCheckSum property is not applied here. Barcode Library will always add a check character in the last digit (modulo 10).
Servlet Parameter: "AddCheckSum".
To set barcode image width and height, there are two ways to do it.
1) You can set barcode image width and height through properties barcodeWidth and barcodeHeight values, barcode library will render the barcode image for you.
or
2) You can set X (barcode module width) and Y (barcode module height) values, barcode library will calculate the barcodeWidth and barcodeHeight values for you, and render the barcode image.