Java EAN-13 Generator
Barcode EAN-13 Generation in Java Class, Jasper Reports, iReport, BIRT
Java Barcode offers the most affordable Java barcode generator for barcode Java professionals.
Java EAN-13 Introduction
EAN-13 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.
Java Barcode EAN-13 Generator - How to generate barcode EAN-13 in Java Class?
The following Java code illustrates how to generate a barcode in Java class:
BarCode barcode = new BarCode();
barcode.setSymbologyType(BarCode.EAN13_2);
barcode.setCodeText("120000000000");
barcode.setSupplementData("22");
BufferedImage ean13Image = barcode.drawBarCode2Image();
Java Barcode EAN-13 Generator - How to generate EAN-13 barcodes to Java Servlet applicatons?
The following Java code illustrates how to generate a barcode in Java Servlet class:
public class BarcodeServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
{
try {
BarCode barcode = new BarCode();
barcode.setSymbologyType(BarCode.EAN13);
barcode.setCodeText("120000000000");
ServletOutputStream servletoutputstream = response.getOutputStream();
barcode.drawBarCode2Stream(servletoutputstream);
} catch (Exception e) {
throw new ServletException(e);
}
}
}
Java Barcode EAN-13 Generator - How to create EAN-13 barcodes through HTTP Request?
-
Install Java Barcode Generator Servlet application to Tomcat or JBoss, developers need copy the barcode folder to your Tomcat application folder, and restart the Tomcat.
-
After Tomcat restarted, open your browser and navigate to http://your_tomcat_url:port/barcode/barCode?code-text=120000000000&symbology-type=16
-
You can also insert barcodes in HTML or JSP pages.
<img src="http://your_tomcat_url:port/barcode/barCode?code-text=120000000000&symbology-type=16">
Java Barcode EAN-13 Generator - How to draw & print barcode EAN-13 to java.awt.Image Object
The following Java source code shows how to generate a barcode in a java.awt.Image object:
private static void demoLinearBarcode() throws Exception
{
BarCode barcode = new BarCode();
barcode.setSymbologyType(BarCode.EAN13);
barcode.setCodeText("120000000000");
java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(300,300,java.awt.image.BufferedImage.TYPE_BYTE_INDEXED );
java.awt.Graphics2D imgGraphics = image.createGraphics();
barcode.paintBarCode(imgGraphics, new java.awt.Rectangle(0, 0, 300, 300));
}
Java EAN-13 Properties
EAN-13 Type Value: com.keepdynamic.barcode.generator.BarCode.EAN13 (16).
EAN-13 Supplement 2 Type Value: com.keepdynamic.barcode.generator.BarCode.EAN13_2 (17).
EAN-13 Supplement 5 Type Value: com.keepdynamic.barcode.generator.BarCode.EAN13_5 (18).
| Class Properties |
HTTP Parameters |
Default |
Comments |
| symbologyType |
symbology-type |
BarCode.CODE128 (8) |
Barcode type |
| codeText |
code-text |
"" |
Barcode value to encode |
| enableChecksum |
enable-checksum |
true |
Checksum for barcode value |
| supplementData |
supplement-data |
"" |
Barcode supplementary value to encode. only valid for EAN-8, EAN-13, UPC-A, UPC-E, ISBN, ISSN |
| supplementSpace |
supplement-space |
15 |
Barcode supplementary space between main barcode and supplement barcode. only valid for EAN-8, EAN-13, UPC-A, UPC-E, ISBN, ISSN |
| graphicsUnit |
graphics-unit |
BarCode.U_PIXEL (0) |
BarCode graphics meature for all size related settings. 0: pixel; 1: cm; 2: inch. Default is pixel |
| X |
x |
2 |
Width of barcode module (narrow bar), default is 2 pixel |
| Y |
y |
75 |
Barcode module height, default is 75 pixel |
| leftMargin |
left-margin |
0 |
Barcode image left margin |
| rightMargin |
right-margin |
0 |
Barcode image right margin |
| topMargin |
top-margin |
0 |
Barcode image top margin |
| bottomMargin |
bottom-margin |
0 |
Barcode image bottom margin |
| resolution |
resolution |
72 |
Barcode image resolution in dpi |
| rotate |
rotate |
0 |
Barcode rotate angle, valid values: 0, 90, 180, 270 |
| displayCodeText |
display-code-text |
true |
If true, display barcode value text, otherwise do not display. |
| codeTextFont |
code-text-font |
"Arial", Font.PLAIN, 11 |
Barcode text font style |
| displayStartStopChar |
display-start-stop-char |
true |
For Code 39 Only. If true, display the start and stop char (*) in the begining and end of barcode value. |
| I |
i |
1.0 |
For Code 39 Only. Width of intercharacter gap, This a multiple of X; default is 1.0 |
| wideNarrowRatio |
wide-narrow-ratio |
2.0 |
For Code 39 and ITF14 Only. Wide vs narrow bar width ratio, valid range 2.0 - 3.0 inclusive, default is 2.0 |
| ITF14BarHori |
itf14-bar-hori |
1.0 |
For ITF14 Only. The value of the horizontal bearer bar. Valid values are 0-10 which are a multiple of X. |
| ITF14BarVert |
itf14-bar-vert |
1.0 |
For ITF14 Only. The value of the vertical bearer bar. Valid values are 0-10 which are a multiple of X. |
| processTilde |
process-tilde |
false |
Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false.
~NNN: is used to represent the ASCII character with the value of NNN. NNN is from 000 - 255. |
| eci |
eci |
3 |
|
| fnc1Mode |
fnc1-mode |
0 (none) |
|
| applicationIndicator |
ai |
0 |
|
Java Barcode Generator supports most common linear (1d) and matrix (2d) bar code standards, including: