jbars
Class BarcodeInter25

java.lang.Object
  |
  +--jbars.Barcode
        |
        +--jbars.BarcodeInter25

public class BarcodeInter25
extends Barcode

Implements the code interleaved 2 of 5. The text can include non numeric characters that are printed but do not generate bars. The default parameters are:

 x = 1f;
 n = 2;
 font=new Font("Helvetica", Font.PLAIN, 20)
 textAlignment = ALIGN_CENTER;
 generateChecksum = false;
 checksumText = false;
 transparent = true;
 shotText = true
 
This class is based on iText "A Free Java-PDF library by Bruno Lowagie and Paulo Soares" using the Mozilla Public License(MPL)

Author:
Andres Ederra, Paulo Soares

Field Summary
(package private) static byte[][] BARS
          The bars to generate the code.
 
Fields inherited from class jbars.Barcode
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, backgroundColor, barHeight, checksumText, CODABAR, code, CODE128, CODE128_RAW, CODE128_UCC, CODE93, codeType, EAN13, EAN8, extended, font, generateChecksum, guardBars, n, PLANET, POSTNET, quietZone, quietZoneX, ROTATE_0, ROTATE_180, ROTATE_270, ROTATE_90, showText, size, startStopText, SUPP2, SUPP5, textAlignment, transparent, TYPE_CODE128, TYPE_CODE93, TYPE_INTERLEAVED2OF5, UPCA, UPCE, x
 
Constructor Summary
BarcodeInter25()
          Creates new BarcodeInter25
 
Method Summary
 float getBarcodeWidth()
          Gets the maximum width that the barcode will occupy.
static byte[] getBarsInter25(java.lang.String text)
          Creates the bars for the barcode.
static char getChecksum(java.lang.String text)
          Calculates the checksum.
static java.lang.String keepNumbers(java.lang.String text)
          Deletes all the non numeric characters from text.
 void placeBarcode(java.awt.image.BufferedImage image, java.awt.Color barColor, java.awt.Color textColor)
          Places the barcode in a BufferedImage.
 
Methods inherited from class jbars.Barcode
createImage, createImage, createPNG, createPNG, createPNG, createPNG, createPNG, createPNG, encodePNG, getBackgroundColor, getBarHeight, getCode, getCodeType, getFont, getFontName, getFontSize, getFontStyle, getN, getQuietZoneX, getSize, getTextAlignment, getX, isChecksumText, isExtended, isGenerateChecksum, isGuardBars, isQuietZone, isShowText, isStartStopText, isTransparent, scale, setBackgroundColor, setBarHeight, setChecksumText, setCode, setCodeType, setExtended, setFont, setFontName, setFontSize, setFontStyle, setGenerateChecksum, setGuardBars, setN, setQuietZone, setQuietZoneX, setShowText, setSize, setStartStopText, setTextAlignment, setTransparent, setX
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BARS

static byte[][] BARS
The bars to generate the code.

Constructor Detail

BarcodeInter25

public BarcodeInter25()
Creates new BarcodeInter25

Method Detail

getBarcodeWidth

public float getBarcodeWidth()
Gets the maximum width that the barcode will occupy. The lower left corner is always (0, 0).

Specified by:
getBarcodeWidth in class Barcode
Returns:
the size the barcode occupies.

getBarsInter25

public static byte[] getBarsInter25(java.lang.String text)
Creates the bars for the barcode.

Parameters:
text - the text. It can contain non numeric characters
Returns:
the barcode

getChecksum

public static char getChecksum(java.lang.String text)
Calculates the checksum.

Parameters:
text - the numeric text
Returns:
the checksum

keepNumbers

public static java.lang.String keepNumbers(java.lang.String text)
Deletes all the non numeric characters from text.

Parameters:
text - the text
Returns:
a String with only numeric characters

placeBarcode

public void placeBarcode(java.awt.image.BufferedImage image,
                         java.awt.Color barColor,
                         java.awt.Color textColor)
Places the barcode in a BufferedImage. The The bars and text are written in the following colors:

barColor

textColor

Result

null

null

bars and text painted with current fill color

barColor

null

bars and text painted with barColor

null

textColor

bars painted with current color
text painted with textColor

barColor

textColor

bars painted with barColor
text painted with textColor

Specified by:
placeBarcode in class Barcode
Parameters:
image - the BufferedImage where the barcode will be placed
barColor - the color of the bars. It can be null
textColor - the color of the text. It can be null
Returns:
void