public class Barcode128 extends Barcode1D
| Modifier and Type | Class and Description |
|---|---|
static class |
Barcode128.Barcode128CodeSet |
| Modifier and Type | Field and Description |
|---|---|
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 int |
CODE128
A type of barcode
|
static int |
CODE128_RAW
A type of barcode
|
static int |
CODE128_UCC
A type of barcode
|
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 |
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, altText, barHeight, baseline, checksumText, code, codeType, DEFAULT_BAR_BACKGROUND_COLOR, DEFAULT_BAR_FOREGROUND_COLOR, document, extended, font, generateChecksum, guardBars, inkSpreading, n, size, startStopText, textAlignment, x| Constructor and Description |
|---|
Barcode128(com.itextpdf.kernel.pdf.PdfDocument document)
Creates new Barcode128
|
| Modifier and Type | Method and Description |
|---|---|
Image |
createAwtImage(Color foreground,
Color background)
Creates a
java.awt.Image. |
com.itextpdf.kernel.geom.Rectangle |
getBarcodeSize()
Gets the maximum area that the barcode and the text, if
any, will occupy.
|
static byte[] |
getBarsCode128Raw(String text)
Generates the bars.
|
Barcode128.Barcode128CodeSet |
getCodeSet() |
static String |
getHumanReadableUCCEAN(String code)
Gets the human readable text of a sequence of AI.
|
static String |
getRawText(String text,
boolean ucc)
Converts the human readable text to the characters needed to
create a barcode.
|
static String |
getRawText(String text,
boolean ucc,
Barcode128.Barcode128CodeSet codeSet)
Converts the human readable text to the characters needed to
create a barcode using the specified code set.
|
com.itextpdf.kernel.geom.Rectangle |
placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color barColor,
com.itextpdf.kernel.colors.Color textColor)
Places the barcode in a
PdfCanvas. |
static String |
removeFNC1(String code)
Removes the FNC1 codes in the text.
|
void |
setCode(String code)
Sets the code to generate.
|
void |
setCodeSet(Barcode128.Barcode128CodeSet codeSet) |
createFormXObject, createFormXObject, fitWidth, getAltText, getBarHeight, getBaseline, getCode, getCodeType, getDescender, 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, setXpublic static final int CODE128
public static final int CODE128_UCC
public static final int CODE128_RAW
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
public Barcode128(com.itextpdf.kernel.pdf.PdfDocument document)
document - The documentpublic void setCodeSet(Barcode128.Barcode128CodeSet codeSet)
public Barcode128.Barcode128CodeSet getCodeSet()
public static String removeFNC1(String code)
code - The text to cleanpublic static String getHumanReadableUCCEAN(String code)
code - the textpublic static String getRawText(String text, boolean ucc, Barcode128.Barcode128CodeSet codeSet)
text - the text to convertucc - true if it is an UCC/EAN-128. In this case
the character FNC1 is addedcodeSet - forced code set, or AUTO for optimized barcode.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 addedpublic static byte[] getBarsCode128Raw(String text)
text - the barcodepublic com.itextpdf.kernel.geom.Rectangle getBarcodeSize()
getBarcodeSize in class Barcode1Dpublic com.itextpdf.kernel.geom.Rectangle placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color barColor,
com.itextpdf.kernel.colors.Color textColor)
PdfCanvas. 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 Barcode1Dcanvas - the PdfCanvas where the barcode will be placedbarColor - the color of the bars. It can be nulltextColor - the color of the text. It can be nullpublic void setCode(String code)
(01)00000090311314(10)ABC123(15)060916public Image createAwtImage(Color foreground, Color background)
java.awt.Image. This image only
contains the bars without any text.createAwtImage in class Barcode1Dforeground - the color of the barsbackground - the color of the backgroundCopyright © 1998–2019 iText Group NV. All rights reserved.