Java EAN-13 GeneratorBarcode 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 EAN-13 Properties
EAN-13 Type Value: com.keepdynamic.barcode.generator.Linear.EAN13 (16). EAN-13 Supplement 2 Type Value: com.keepdynamic.barcode.generator.Linear.EAN13_2 (17). EAN-13 Supplement 5 Type Value: com.keepdynamic.barcode.generator.Linear.EAN13_5 (18).
Java Barcode EAN-13 Generator - Java Class Implementation
The following Java code illustrates how to generate a barcode in Java class:
22 private static void testLinear() throws Exception
23 {
24 Linear barcode = new Linear();
25
26 // set barcode properties
27 barcode.setType(Linear.CODE128);
28 barcode.setData("1234567890");
29
30 // draw and generate barcode to specified file
31 barcode.draw("C:\\Code128.gif");
32 }
Java Barcode EAN-13 Generator - Java Servlet Implementation
The following Java code illustrates how to generate a barcode in Java Servlet class:
11 public class BarcodeServlet extends HttpServlet {
12 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
13 {
14 try {
15 Linear barcode = new Linear();
16
17 // set barcode properties
18 barcode.setType(Linear.CODE128);
19 barcode.setData("1234567890");
20
21 // draw and generate barcode to response's ServletOutputStream
22 ServletOutputStream servletoutputstream = response.getOutputStream();
23
24 barcode.draw(servletoutputstream);
25
26 } catch (Exception e) {
27 throw new ServletException(e);
28 }
29 }
30 }
31
View BarcodeServlet.java source code Java Barcode EAN-13 Generator - HTTP Request Implementation
Java Barcode EAN-13 Generator - java.awt.Image Object Implementation
The following Java source code shows how to generate a barcode in a java.awt.Image object:
21
22 private static void testLinear() throws Exception
23 {
24 Linear barcode = new Linear();
25
26 // set barcode properties
27 barcode.setType(Linear.CODE128);
28 barcode.setData("1234567890");
29
30 // create image object
31 java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(300,300,java.awt.image.BufferedImage.TYPE_BYTE_INDEXED );
32 // get graphic context of image
33 java.awt.Graphics2D imgGraphics = image.createGraphics();
34
35 // draw barcode to specified location in Rectangle
36 barcode.draw(imgGraphics, new java.awt.Rectangle(0, 0, 300, 300));
37 }
Java Barcode supports: 2D / Matrix Barcode Symbologies: Data Matrix, PDF-417, QR-Code 1D / Linear Barcode Symbologies: Codabar, Code 11, Code 2 of 5, Interleaved 2 of 5, Code 39, Code 93, Code 128 EAN 128, EAN 8, EAN 13, UPC-A, UPC-E, ISBN, ISSN, ITF-14, Identcode, Leitcode, MSI Plessey, Onecode, Planet, Postnet, RM4SCC, |