Java EAN-13 Generator Size Setting Tutorial

sample source code to generate linear EAN-13 images and adjust barcode size in Java


  • Generate barcodes which can be added to Oracle Reports and Crystal Reports
  • Compatible with JDK 1.4 or greater
  • Servlets are compatible with all browsers, easy to embed in HTML as an image with the tag and can be used to add server-side barcode generator capability to a dedicated Web server
  • Easy encapsulation, integration and customization are supported with JavaBean conforming to a particular convention under a developmental environment
  • Class library contains all necessary class files for java barcode generation
  • Mature & Reliable Java EAN-13 generation library with latest barcode symbology ISO Standards
  • Easy to generate EAN-13 images in Java Reports, such as Jasper Report, iReport, Eclipse BIRT and Oracle Reports
  • Text margin, text font can influence the size of EAN-13 in Java
  • autoResize can adjust the generated EAN-13 barcode image in Java automatically
  • Common-used image formats are valid here, which are png, tiff, gif, jpeg and bmp
  • EAN-13 barcode can be set in the center, right or left of the image

EAN-13, also known as European Article Number 13, UPC-13, GTIN-13, GS1-13, EAN/UCC-13, is the standard barcode version of European Article Number.

Java EAN-13 image setting provides detailed tutorial guide on EAN 13 image setting such as color, resolution, rotation and so on;

Java EAN-13 data encoding provides detailed tutorial guide on EAN 13 available data legnth and data set.


EAN-13 in Java Size Concerned Properties

EAN-13 Related Size Settings in Java

  • X: Width of EAN-13 bar module (narrow bar), default is 1 pixel.
  • barcodeWidth: EAN-13 barcode image width value.
  • leftMargin: EAN-13 image left margin size.
  • rightMargin: EAN-13 image right margin size.
  • Y: Height of EAN-13 bar module, default is 30 pixel.
  • barcodeHeight: EAN-13 barcode image height value.
  • topMargin: EAN-13 image top margin size.
  • bottomMargin: EAN-13 image bottom margin size.
  • autoResize: Auto resize the generated EAN-13 barcode image.
  • uom: Unit of meature for all size related settings in the Java barcode library. Valid values: 0: pixel; 1: inch; 2: cm.
  • textMargin: Space between barcode and printed barcode data, default is 6 pixel.
  • textFont: EAN-13 text font style.

EAN-13 Supplemental Barcode Size Setting Parameters in Java

Java EAN 13 can only encode 12 digits with a check sum. Moreover, 2-digit (EAN 2) and 5-digit (EAN 5) supplemental barcodes may be added for a total of 14 or 17 data digits. These are generally used for periodicals (to indicate the serial number), or books and weighed products like food (to indicate the selling price), respectively.

  • subSpace: the space between main EAN 13 barcode and supplemental barcode image; the default value is 15 pixel.
  • subHeight: a multiplicator of the height of the bar module; The default is 0.8 (80% of Y - bar module height).


How to Implement EAN-13 Size Setting Properties in Java Projects

Java EAN-13 generator supports all EAN-13 size related solution to specify the EAN-13 images generated in Java. After purchasing the EAN-13 generator for Java, please install and set up it, then copy the following code into your Java IntelliJ IDEA:

      Code39 barcode = new Code39();
barcode.setData("123456789012");

Java EAN-13 Size Setting Properties in Java - Sample Code

      barcode.setUom(IBarcode.UOM_PIXEL);
barcode.setX(2f);
barcode.setLeftMargin(3f);
barcode.setRightMargin(3f);
barcode.setY(60f);
barcode.setTopMargin(3f);
barcode.setBottomMargin(3f);
//Set the show text to be true for adjustment in Java barcode.setShowText(true);
barcode.setTextFont(new Font("Arial", 0, 12));
barcode.setTextMargin(10);

Java EAN-13 Supplement Barcode Size Setting Parameters Sample Code

For EAN-13 supplement barcode size setting and adjustment, you need to set the supplement data at first, and then set the subspace and subHeight to change the size of supplement barcode.

      barcode.setsubData("12");
barcode.setsubSpace(30);
barcode.setsubHeight(2);




OnBarcode is a market-leading provider of barcode generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides high quality tutorials and guides for various linear, 2d barcode information, such as C# Barcode, QR Code C#, QR Code VB.NET, QR Code ASP.NET, QR Code .NET, ASP.NET Barcode. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.