Java Code 128 Generator Image Setting Tutorial

sample source code to generate linear Code 128 in png, jpeg, etc. image formats in Java

  • Permanent license with the purchase of the developer license
  • Generate barcodes which can be added to Oracle Reports and Crystal Reports
  • Class library contains all necessary class files for java barcode generation
  • Draw high-quality Code 128 barcodes in Java Class, J2SE applications by setting the size of barcode
  • Java Client applications (Java Class, Swing, Applet, Java Bean and J2SE) are supported
  • Code 128 image width in Java can be changed with Y (bar height), barcodeHeight, topMargin and bottomMargin
  • Unit of Measure can set the generated Code 128 image in Inch, CM or Pixel
  • Text margin, text font can influence the size of Code 128 in Java
  • Show text can enable or disenable with Java Code 128 generator
  • High quality Code 128 images may be printed with any printers, including those low resolution printers

Code 128, also known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, is a very capable linear barcode of excellent density, high reliability.

Onbarcode Java Linear Barcode Generator supports 21 linear barcode types' generation and print with about 50 properties to be adjusted to meet any possible requirement.

Code 128 Size Setting for Java concentrates on setting Code 128 linear barcode bar height and width, space and margins from all sides;

Code 128 Data Encoding for Java concentrates on setting Code 128 different character sets with defferent data length in Java applications.

Java Code 128 Image Setting Common Properties and Uses

      Code128 barcode = new Code128();

Adjust Code 128 Image Positon

Code 128 image position can be set with rotate and bar alignment:

      //Code 128 generated in Java with 0, 90, 180, 270 angles b y rotating it, default is 0 (IBarcode.ROTATE_0);
        Valid choices are 0 (IBarcode.ROTATE_0); 1 (IBarcode.ROTATE_90); 2 (IBarcode.ROTATE_180); 
        3 (IBarcode.ROTATE_270);
      barcode.setroatte(1 (IBarcode.ROTATE_90));
//Barcode horizontal alignment inside Code 128 can be set among with 0: left, 1: center, 2: right; default is 1: center. barcode.setbarAlignment(0(left));

Java Code 128 Image Resolution, Color and Rotation

      //Code 128 resolution is set in DPI which stands for Dot Per Inch.default is 72;
//Java Code 128 image background color, default is white; barcode.setbackColor(red);
//Java Code 128 fore ground color, which actually is the bar color, default is black; barcode.setforeColor(black);
//the color of the text below the image barcode.settextColor(black);
//rotate the Code 128 image with 0, 90, 180, 270 degrees in Java projects barcode.setRotate(IBarcode.ROTATE_0);

Hide Code 128 Text

Code 128 generator in Java show text can be enable or disable with your need. If the show text property is set to be false, the text of the Code 128 in Java can be hided without showing


Java Code 128 Image Format Setting

Java Code 128 generation control supports generating high quality Code 128 image with common used image formats like png, tiff, gif, jpeg and bmp. A sample code is below for your easier implementation with just copying and changing to the target format.

      barcode.drawBarcode("C:\\Code 128.jpeg");

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 .NET HTML5 Document Viewer 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 © . All rights reserved.