com.lowagie.text.pdf
public abstract class Barcode extends Object
Field Summary | |
---|---|
protected String | altText
The alternate text to be used, if present. |
protected float | barHeight The height of the bars. |
protected float | baseline If positive, the text distance under the bars. |
protected boolean | checksumText Shows the generated checksum in the the text. |
protected String | code The code to generate. |
protected int | codeType The code type. |
static int | CODABAR A type of barcode |
static int | CODE128 A type of barcode |
static int | CODE128_RAW A type of barcode |
static int | CODE128_UCC A type of barcode |
protected boolean | extended Generates extended barcode 39. |
static int | EAN13 A type of barcode |
static int | EAN8 A type of barcode |
protected BaseFont | font The text font. |
protected boolean | generateChecksum The optional checksum generation. |
protected boolean | guardBars Show the guard bars for barcode EAN. |
protected float | inkSpreading The ink spreading. |
protected float | n The bar multiplier for wide bars or the distance between
bars for Postnet and Planet. |
static int | PLANET A type of barcode |
static int | POSTNET A type of barcode |
protected float | size The size of the text or the height of the shorter bar
in Postnet. |
protected boolean | startStopText Show the start and stop character '*' in the text for
the barcode 39 or 'ABCD' for codabar. |
static int | SUPP2 A type of barcode |
static int | SUPP5 A type of barcode |
protected int | textAlignment The text alignment. |
static int | UPCA A type of barcode |
static int | UPCE A type of barcode |
protected float | x The minimum bar width. |
Method Summary | |
---|---|
abstract Image | createAwtImage(Color foreground, Color background) Creates a java.awt.Image . |
Image | createImageWithBarcode(PdfContentByte cb, Color barColor, Color textColor) Creates an Image with the barcode. |
PdfTemplate | createTemplateWithBarcode(PdfContentByte cb, Color barColor, Color textColor) Creates a template with the barcode. |
String | getAltText()
Gets the alternate text. |
abstract Rectangle | getBarcodeSize() Gets the maximum area that the barcode and the text, if
any, will occupy. |
float | getBarHeight() Gets the height of the bars. |
float | getBaseline() Gets the text baseline.
|
String | getCode() Gets the code to generate. |
int | getCodeType() Gets the code type. |
BaseFont | getFont() Gets the text font. |
float | getInkSpreading() Gets the amount of ink spreading. |
float | getN() Gets the bar multiplier for wide bars. |
float | getSize() Gets the size of the text. |
int | getTextAlignment() Gets the text alignment. |
float | getX() Gets the minimum bar width. |
boolean | isChecksumText() Gets the property to show the generated checksum in the the text. |
boolean | isExtended() Gets the property to generate extended barcode 39. |
boolean | isGenerateChecksum() Gets the optional checksum generation. |
boolean | isGuardBars() Gets the property to show the guard bars for barcode EAN. |
boolean | isStartStopText() Sets the property to show the start and stop character '*' in the text for
the barcode 39. |
abstract Rectangle | placeBarcode(PdfContentByte cb, Color barColor, Color textColor) Places the barcode in a PdfContentByte . |
void | setAltText(String altText)
Sets the alternate text. |
void | setBarHeight(float barHeight) Sets the height of the bars. |
void | setBaseline(float baseline) Sets the text baseline.
|
void | setChecksumText(boolean checksumText) Sets the property to show the generated checksum in the the text. |
void | setCode(String code) Sets the code to generate. |
void | setCodeType(int codeType) Sets the code type. |
void | setExtended(boolean extended) Sets the property to generate extended barcode 39. |
void | setFont(BaseFont font) Sets the text font. |
void | setGenerateChecksum(boolean generateChecksum) Setter for property generateChecksum. |
void | setGuardBars(boolean guardBars) Sets the property to show the guard bars for barcode EAN. |
void | setInkSpreading(float inkSpreading) Sets the amount of ink spreading. |
void | setN(float n) Sets the bar multiplier for wide bars. |
void | setSize(float size) Sets the size of the text. |
void | setStartStopText(boolean startStopText) Gets the property to show the start and stop character '*' in the text for
the barcode 39. |
void | setTextAlignment(int textAlignment) Sets the text alignment. |
void | setX(float x) Sets the minimum bar width. |
null
if no text.Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
or Element.ALIGN_RIGHT
.java.awt.Image
. This image only
contains the bars without any text.Parameters: foreground the color of the bars background the color of the background
Returns: the image
Image
with the barcode.Parameters: cb the PdfContentByte
to create the Image
. It
serves no other use barColor the color of the bars. It can be null
textColor the color of the text. It can be null
Returns: the Image
See Also: Barcode
Parameters: cb the PdfContentByte
to create the template. It
serves no other use barColor the color of the bars. It can be null
textColor the color of the text. It can be null
Returns: the template
See Also: Barcode
Returns: the alternate text
Returns: the size the barcode occupies.
Returns: the height of the bars
Returns: the baseline.
Returns: the code to generate
Returns: the code type
null
if no text.Returns: the text font. null
if no text
Returns: the ink spreading
Returns: the bar multiplier for wide bars
Returns: the size of the text
Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
or Element.ALIGN_RIGHT
.Returns: the text alignment
Returns: the minimum bar width
Returns: value of property checksumText
Returns: value of property extended.
Returns: the optional checksum generation
Returns: value of property guardBars
Returns: value of property startStopText
PdfContentByte
. The
barcode is always placed at coodinates (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 |
Parameters: cb the PdfContentByte
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: the dimensions the barcode occupies
Parameters: altText the alternate text
Parameters: barHeight the height of the bars
Parameters: baseline the baseline.
Parameters: checksumText new value of property checksumText
Parameters: code the code to generate
Parameters: codeType the code type
Parameters: extended new value of property extended
Parameters: font the text font. Set to null
to suppress any text
Parameters: generateChecksum New value of property generateChecksum.
Parameters: guardBars new value of property guardBars
Parameters: inkSpreading the ink spreading
Parameters: n the bar multiplier for wide bars
Parameters: size the size of the text
Parameters: startStopText new value of property startStopText
Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
or Element.ALIGN_RIGHT
.Parameters: textAlignment the text alignment
Parameters: x the minimum bar width