Java Code 39 Generator Image Setting Tutorial
sample source code to generate linear Code 39 in png, jpeg, etc. image formats in Java
- Java Client applications (Java Class, Swing, Applet, Java Bean and J2SE) are supported
- Easy to generate Code 39 images in Java Reports, such as Jasper Report, iReport, Eclipse BIRT and Oracle Reports
- Show text can enable or disenable with Java Code 39 generator
- Compatible headless Java which can easily allow images to be created without graphic environment in JDK 1.4 and later version
- Applet allows Code 39 easily integrated into web pages
- Text margin, text font can influence the size of Code 39 in Java
- Code 39 image color can be changed with setting BackColor, ForeColor and TextColor
- Common-used image formats are valid here, which are png, tiff, gif, jpeg and bmp
Code 39, also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3, is the first alpha-numeric linear barcode symbology used world-wide.
Onbarcode Java Barcode Generator is developed with detailed guide for Java Code 39 concerning data encoding and size setting.
Go to Code 39 Size Setting for Java for samples of setting Code 39 bar width, bar height, image width, image height, margins and so on;
Go to Code 39 Data Encoding for Java for samples of encoding Code 39 available data set and data length.
Java Code 39 Image Setting Aspects
Java Code 39 generation component is easy to set the Code 39 related image settings such as image format, image resolution, rotation, color and showStartStopText for generating superb quality Code 39 images in Java projects.
- resolution: Code 39 barcode image resolution in DPI (Dots per inch), default is 72;
- rotate: show the Code 39 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);
- backColor: Java Code 39 image background color, default is white;
- foreColor: Java Code 39 fore ground color, which actually is the bar color, default is black;
- showStartStopText: a * in the beginning and end of the Code 39 barcode text if setting this property to be true, default is true;
- barAlignment: Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right; default is 1: center.
Java Code 39 Image Setting Implementation
The specific aspects and samples are present as the following points. Before adjusting the image concerned properties, the first step is to build Code 39 object.
Code39 barcode = new Code39();
Java Code 39 Image Resolution Setting
Code 39 image resolution can be set to be any fixed value with Code 39 generation library:
Java Code 39 Image Color Setting
Code 39 generated in Java is not simply black and white but can be colorful with background color, foreground color, text color three aspects:
Show text for Java Code 39
Code 39 generator in Java show text can be enable or disable with your need.
Java Code 39 Bar Alignment Setting
Java Code 39 barAlignment supports put the Code 39 bars in the left, right or center side of the barcode image in Java.
Java Code 39 Image Rotation Setting
Some package may need special requirement for Code 39 text and barcode angles. Code 39 generation component can rotate the Code 39 image with 0, 90, 180, 270 degrees in Java projects.
Java Code 39 Image Format Setting
Java Code 39 generation control supports generating high quality Code 39 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.