jbars
Class Barcode93

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

public class Barcode93
extends Barcode

Implements the code 93. The default parameters are:

 x = 1f;
 n = 2;
 font = new Font("Helvetica",Font.PLAIN,20));
 textAlignment = ALIGN_CENTER;
 generateChecksum = false;
 checksumText = false;
 startStopText = true;
 extended = false;
 codeType = CODE93;
 transparent = true;
 shotText = true
 generateChecksum = true;
 checksumText = false;
 
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

Field Summary
static java.lang.String ASCII_CHARS
          ASCII chars representation in Code 93 using escape chars.
(package private) static byte[][] BARS
          The bars to generate the code.
static java.lang.String CHARS
          Code 93 chars ordered by code93 value
(package private) static byte[][] ESCAPE_BARS
          Bars to represent escape chars index 0 = First escape char used in ASCII_CHARS array index 1 = Second escape char used in ASCII_CHARS array index 2 = Thirth escape char used in ASCII_CHARS array index 3 = Fourth escape char used in ASCII_CHARS array
(package private) static byte[] START_BAR
          The Start bar
(package private) static byte[] STOP_BAR
          The Stop bar
 
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
Barcode93()
          Creates a new Barcode39.
 
Method Summary
 float getBarcodeWidth()
          Gets the maximum width that the barcode will occupy.
(package private) static byte[] getBarsCode93(java.lang.String text)
          Creates the bars.
static java.lang.String getChecksum(java.lang.String text)
          Calculates the checksum.
(package private) static java.lang.String getCode93ASCII(java.lang.String text)
          Converts the ASCII text into a normal, escaped text, ready to generate bars.
 void placeBarcode(java.awt.image.BufferedImage i, 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

START_BAR

static byte[] START_BAR
The Start bar


STOP_BAR

static byte[] STOP_BAR
The Stop bar


ESCAPE_BARS

static byte[][] ESCAPE_BARS
Bars to represent escape chars index 0 = First escape char used in ASCII_CHARS array index 1 = Second escape char used in ASCII_CHARS array index 2 = Thirth escape char used in ASCII_CHARS array index 3 = Fourth escape char used in ASCII_CHARS array


BARS

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


CHARS

public static java.lang.String CHARS
Code 93 chars ordered by code93 value


ASCII_CHARS

public static java.lang.String ASCII_CHARS
ASCII chars representation in Code 93 using escape chars. First digit is escape char using this convention: escape ' ' = No escape char escape '*' = First Escape char; Barcode93 value 43 escape '&' = Second Escape char; Barcode93 value 44 escape '#' = Thirth Escape char; Barcode93 value 45 escape '@' = Fourth Escape char; Barcode93 value 46 The second digit is the code 93 char to use

Constructor Detail

Barcode93

public Barcode93()
Creates a new Barcode39.

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.

getBarsCode93

static byte[] getBarsCode93(java.lang.String text)
Creates the bars.

Parameters:
text - the text to create the bars. This text does not include the start and stop characters
Returns:
the bars

getCode93ASCII

static java.lang.String getCode93ASCII(java.lang.String text)
Converts the ASCII text into a normal, escaped text, ready to generate bars.

Parameters:
text - the extended text
Returns:
the escaped text

getChecksum

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

Parameters:
text - the text
Returns:
the checksum

placeBarcode

public void placeBarcode(java.awt.image.BufferedImage i,
                         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:
barColor - the color of the bars. It can be null
textColor - the color of the text. It can be null
Returns:
void