Java EAN-128 Generator Size Setting Tutorial
sample source code to generate linear EAN-128 images and adjust barcode size in Java
- Valid character set and available data length can be referred in the EAN-128 page
- The generated EAN-128 image resolution can be set to be a fixed value with your need
- Java EAN-128 generation component supports rotating EAN-128 image with 0, 90, 180, 270 angles
- Unit of Measure can set the generated EAN-128 image in Inch, CM or Pixel
- Text margin, text font can influence the size of EAN-128 in Java
- Completely developed in Java for any operating systems with Java Virtual Machine
- Pre-configured industry standards EAN-128 allow any untrained users to insert EAN-128 in Java
- Check sum digit of EAN-128 image can be automatically computed
- Detailed tutorial guide for Java EAN-128 generator is provided for your easier programming
GS1-128, former known as EAN-128, UCC-128, USS-128, is alphanumeric linear barcode developed on Code 128, however, using GS1 standard.
To change GS1 128 image format, color and resolution and other relaed parameters in Java, please go to Java GS1 128 image setting;
To encode GS1 128 valid data set and data length in Java, please go to Java GS1 128 data encoding.
GS1 128 in Java Size Concerned Properties and Implementation
GS1 128 java barcode generator is also named EAN-128 barcode generator in Java, which supports all size setting parameters to adjust the size of the generated EAN 128 image in Java platforms. Before all of the following barcode size setting, you need to install and set up Java EAN 128 Generator after purchasing the Java barcode developer license.Then copy the following code in to your Java class library.
Code39 barcode = new Code39();
barcode.setData("123456789012");
barcode.setExtension(false);
GS1 128 Bar Module Related Settings in Java
- Y: Height of GS1 128 bar module, default is 30 pixel.
- X: Width of GS1 128 bar module (narrow bar), default is 1 pixel.
Sample code is as follows:
barcode.setX(4f);
barcode.setY(100f);
GS1 128 Space Related Settings in Java
- topMargin: GS1 128 image top margin size, default value is 0.
- bottomMargin: GS1 128 image bottom margin size, default value is 0.
- leftMargin: GS1 128 image left margin size, default value is 0.
- rightMargin: GS1 128 image right margin size, default value is 0.
Sample code is as below:
barcode.setTopMargin(1f);
barcode.setBottomMargin(2f);
barcode.setLeftMargin(1f);
barcode.setRightMargin(2f);
GS1 128 Overall Size Setting Properties in Java
- autoResize: Auto resize the generated GS1 128 barcode image.
- barcodeWidth: Generated GS1 128 barcode image width, default value is 0.
- uom: Unit of meature for all size related settings in the Java barcode library. Valid values: 0: pixel; 1: inch; 2: cm.
- barcodeHeight: Generated GS1 128 barcode image height, default value is 0.
Sample code is as below:
barcode.setUom(IBarcode.UOM_PIXEL);
barcode.setbarcdoeWidth(190);
barcode.setbarcodeHeight(88);
barcode.setsutoResize(true);
GS1 128 Overall Size Setting Properties in Java
- textMargin: Space between barcode and printed barcode data, default is 6 pixel.
- textFont: GS1 128 text (printed below barcode) font style, default is (new Font("Arial", 0, 12)).
Sample code is as follows:
//Set the show text to be true for adjustment in Java
barcode.setShowText(true);
barcode.setTextFont(new Font("Arial", 0, 12));
barcode.setTextMargin(6);
Note that, once setting a fixed X, a minimum BarCodeWidth EAN 128 image is automatically created in Java. If your set BarCodeWidth is smaller than the minimum value, the generated EAN 128 image width will be the minimum barcode width value in java. If your set BarCodeWidth is larger than the minimum value, the generated EAN 128 image width will be the set barcode. The situation is same as EAN 128 barcode height settings with Y and barcodeHeight.