|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.Barcode
com.lowagie.text.pdf.Barcode128
public class Barcode128
Implements the code 128 and UCC/EAN-128. Other symbologies are allowed in raw mode.
The code types allowed are:
x = 0.8f; font = BaseFont.createFont("Helvetica", "winansi", false); size = 8; baseline = size; barHeight = size * 3; textAlignment = Element.ALIGN_CENTER; codeType = CODE128;
Field Summary | |
---|---|
private static IntHashtable |
ais
|
private static byte[][] |
BARS
The bars to generate the code. |
private static byte[] |
BARS_STOP
The stop bars. |
static char |
CODE_A
|
static char |
CODE_AB_TO_C
The charset code change. |
static char |
CODE_AC_TO_B
The charset code change. |
static char |
CODE_BC_TO_A
The charset code change. |
static char |
CODE_C
|
static char |
DEL
|
static char |
FNC1
|
static char |
FNC1_INDEX
The code for UCC/EAN-128. |
static char |
FNC2
|
static char |
FNC3
|
static char |
FNC4
|
static char |
SHIFT
|
static char |
START_A
The start code. |
static char |
START_B
The start code. |
static char |
START_C
The start code. |
static char |
STARTA
|
static char |
STARTB
|
static char |
STARTC
|
Fields inherited from class com.lowagie.text.pdf.Barcode |
---|
altText, barHeight, baseline, checksumText, CODABAR, code, CODE128, CODE128_RAW, CODE128_UCC, codeType, EAN13, EAN8, extended, font, generateChecksum, guardBars, inkSpreading, n, PLANET, POSTNET, size, startStopText, SUPP2, SUPP5, textAlignment, UPCA, UPCE, x |
Constructor Summary | |
---|---|
Barcode128()
Creates new Barcode128 |
Method Summary | |
---|---|
Image |
createAwtImage(Color foreground,
Color background)
Creates a java.awt.Image . |
Rectangle |
getBarcodeSize()
Gets the maximum area that the barcode and the text, if any, will occupy. |
static byte[] |
getBarsCode128Raw(String text)
Generates the bars. |
static String |
getHumanReadableUCCEAN(String code)
Gets the human readable text of a sequence of AI. |
(package private) static String |
getPackedRawDigits(String text,
int textIndex,
int numDigits)
Packs the digits for charset C also considering FNC1. |
static String |
getRawText(String text,
boolean ucc)
Converts the human readable text to the characters needed to create a barcode. |
(package private) static boolean |
isNextDigits(String text,
int textIndex,
int numDigits)
Returns true if the next numDigits
starting from index textIndex are numeric skipping any FNC1. |
Rectangle |
placeBarcode(PdfContentByte cb,
Color barColor,
Color textColor)
Places the barcode in a PdfContentByte . |
static String |
removeFNC1(String code)
Removes the FNC1 codes in the text. |
void |
setCode(String code)
Sets the code to generate. |
Methods inherited from class com.lowagie.text.pdf.Barcode |
---|
createImageWithBarcode, createTemplateWithBarcode, getAltText, getBarHeight, getBaseline, getCode, getCodeType, getFont, getInkSpreading, getN, getSize, getTextAlignment, getX, isChecksumText, isExtended, isGenerateChecksum, isGuardBars, isStartStopText, setAltText, setBarHeight, setBaseline, setChecksumText, setCodeType, setExtended, setFont, setGenerateChecksum, setGuardBars, setInkSpreading, setN, setSize, setStartStopText, setTextAlignment, setX |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final byte[][] BARS
private static final byte[] BARS_STOP
public static final char CODE_AB_TO_C
public static final char CODE_AC_TO_B
public static final char CODE_BC_TO_A
public static final char FNC1_INDEX
public static final char START_A
public static final char START_B
public static final char START_C
public static final char FNC1
public static final char DEL
public static final char FNC3
public static final char FNC2
public static final char SHIFT
public static final char CODE_C
public static final char CODE_A
public static final char FNC4
public static final char STARTA
public static final char STARTB
public static final char STARTC
private static final IntHashtable ais
Constructor Detail |
---|
public Barcode128()
Method Detail |
---|
public static String removeFNC1(String code)
code
- the text to clean
public static String getHumanReadableUCCEAN(String code)
code
- the text
static boolean isNextDigits(String text, int textIndex, int numDigits)
true
if the next numDigits
starting from index textIndex
are numeric skipping any FNC1.
text
- the text to checktextIndex
- where to check fromnumDigits
- the number of digits to check
static String getPackedRawDigits(String text, int textIndex, int numDigits)
text
- the text to packtextIndex
- where to pack fromnumDigits
- the number of digits to pack. It is always an even number
public static String getRawText(String text, boolean ucc)
text
- the text to convertucc
- true
if it is an UCC/EAN-128. In this case
the character FNC1 is added
public static byte[] getBarsCode128Raw(String text)
text
- the barcode
public Rectangle getBarcodeSize()
getBarcodeSize
in class Barcode
public Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor)
PdfContentByte
. The
barcode is always placed at coordinates (0, 0). Use the
translation matrix to move it elsewhere.The bars and text are written in the following colors:
|
|
Result |
---|---|---|
|
|
bars and text painted with current fill color |
|
|
bars and text painted with |
|
|
bars painted with current color |
|
|
bars painted with |
placeBarcode
in class Barcode
cb
- the PdfContentByte
where the barcode will be placedbarColor
- the color of the bars. It can be null
textColor
- the color of the text. It can be null
public Image createAwtImage(Color foreground, Color background)
java.awt.Image
. This image only
contains the bars without any text.
createAwtImage
in class Barcode
foreground
- the color of the barsbackground
- the color of the background
public void setCode(String code)
(01)00000090311314(10)ABC123(15)060916
setCode
in class Barcode
code
- the code to generate
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |