Package totalcross.barcode
Class BarcodeInter25
- java.lang.Object
-
- totalcross.barcode.Barcode
-
- totalcross.barcode.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 = trueThis class is based on iText "A Free Java-PDF library by Bruno Lowagie and Paulo Soares" using the Mozilla Public License(MPL)
-
-
Field Summary
-
Fields inherited from class totalcross.barcode.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, showText, size, startStopText, SUPP2, SUPP5, textAlignment, transparent, TYPE_CODE128, TYPE_CODE93, TYPE_INTERLEAVED2OF5, UPCA, UPCE, x
-
-
Constructor Summary
Constructors Constructor Description BarcodeInter25()Creates new BarcodeInter25
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBarcodeWidth()Gets the maximum width that the barcode will occupy.static byte[]getBarsInter25(java.lang.String text)Creates the bars for the barcode.static chargetChecksum(java.lang.String text)Calculates the checksum.static java.lang.StringkeepNumbers(java.lang.String text)Deletes all the non numeric characters fromtext.voidplaceBarcode(Image image, int barColor, int textColor)Places the barcode in a Image.-
Methods inherited from class totalcross.barcode.Barcode
createImage, createImage, getBackgroundColor, getBarHeight, getCode, getCodeType, getFont, getFontName, getFontSize, 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
-
-
-
-
Method Detail
-
getBarcodeWidth
public int getBarcodeWidth()
Gets the maximum width that the barcode will occupy. The lower left corner is always (0, 0).- Specified by:
getBarcodeWidthin classBarcode- 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 fromtext.- Parameters:
text- the text- Returns:
- a
Stringwith only numeric characters
-
placeBarcode
public void placeBarcode(Image image, int barColor, int textColor)
Places the barcode in a Image. The The bars and text are written in the following colors:barColortextColorResult
nullnullbars and text painted with current fill color
barColornullbars and text painted with
barColornulltextColorbars painted with current color
text painted withtextColorbarColortextColorbars painted with
barColor
text painted withtextColor- Specified by:
placeBarcodein classBarcode- Parameters:
image- theImagewhere the barcode will be placedbarColor- the color of the bars. It can be-1textColor- the color of the text. It can be-1
-
-