KA.Barcode for Java
Guide for Resizing Code 128 Barcodes in Java
Complete Java source code to generate, print Code 128 images and change barcode size with Java Control

Java Code 128 barcode generator library: generate, print barcode Code 128 encoder in Java class, JasperReports, Apache web application

Code 128 Barcode Generator for Java Overview
  • Compatible with JSP,J2EE and other web projects
  • Mature & Reliable Java Code 39 generation library with latest barcode symbology ISO Standards
  • Supports Java Reports software to set your wanted size of Code 128
  • Completely developed in Java for any operating systems with Java Virtual Machine.
  • A Srvlet, Applet, JavaBean and class library are contained in the Java Code 128 generator package
  • Provide professional features to set inter-character space and wide narrow bar ratio for Code 128
  • Text margin, text font can influence the size of Code 128 in Java
  • Common-used image formats are valid here, which are png, tiff, gif, jpeg and bmp
  • Code 128 barcode can be set in the center, right or left of the image
Related Code 128 Java Generation Setting Pages
Code 128 is also named as ANSI/AIM 128, Uniform Symbology Specification Code 128, USS Code 128. Excluding Java Code 128 Size Setting, KeepAutomation provides other concerned Code 128 generation setting properties for adjust the image and encoding data:
Java Code 128 Size Setting Parameters

Three character set for Code 128 generation in Java

Three character set for Code 128 generation in Java:

  • 0 (SET_AUTO), 1 (SET_A), 2 (SET_B), 3 (SET_C)
  • 0 (SET_AUTO), 1 (SET_A), 2 (SET_B), 3 (SET_C)
  • 0 (SET_AUTO), 1 (SET_A), 2 (SET_B), 3 (SET_C)

Java Code 128 Height Related Properties

barcode.setY(80);//default is 75

barcode.setbarcodeHeight(160); //default is 0

barcode.settopMargin(5); //default is 0

barcode.settopMargin(5); //default is 0

Code 128 Width Related Properties in Java

barcode.setX(3); //default is 2

barcode.setbarcodeWidth(180); //default is 0

barcode.setleftMargin(3); //default is 0

barcode.setrightMargin(3); //default is 0

Other Code 128 Size Related properties in Java

barcode.setUOM(UOM_INCH (2)); //default is UOM_PIXEL (0)

barcode.settextFont("Arial", Font.PLAIN, 15); //default is "Arial", Font.PLAIN, 11

barcode.settextFont("Arial", Font.PLAIN, 15); //default is "Arial", Font.PLAIN, 11

Code 128 Size Setting in Java - Common situations

Generate Code 128 image with a fixed Bar Width in Java

Generate Code 128 image with a fixed Bar Width in Java

Generate Code 128 image with a fixed Bar Width in Java

barcode.setautoReisize(false);

Create Code 128 image with a fixed Image Width in Java

In java applications, Code 128 image width can be set with the property - BarCodeWidth. To set a fixed image width, the Code 128 image will be drawn with the fixed image width.

barcode.setBarCodeWidth (160);

barcode.setautoReisize(true);

Draw Code 128 image with a Minimum X and BarCodeWidth in Java

In java applications, Code 128 image size can be changed with X and BarCodeWidth at the same time.

barcode.setX(2);

barcode.setBarCodeWidth (120);

barcode.setautoReisize(false);

Note that, once setting a fixed X, a minimum BarCodeWidth Code 128 image is automatically created in Java. If your set BarCodeWidth is smaller than the minimum value, the generated Code 128 image width will be the minimum barcode width value in java. This situation is the same as BarCodeHeight.