Class PDF417Bean
java.lang.Object
org.krysalis.barcode4j.impl.AbstractBarcodeBean
org.krysalis.barcode4j.impl.pdf417.PDF417Bean
- All Implemented Interfaces:
BarcodeGenerator
This class is an implementation of the PDF417 barcode.
- Version:
- $Id: PDF417Bean.java,v 1.7 2012-05-17 13:57:37 jmaerki Exp $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe default column count for PDF417.protected static final intThe default error correction level for PDF417protected static final doubleThe default module width for PDF417.protected static final intThe default wide factor for PDF417.Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone, quietZoneVertical -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcDimensions(String msg) Calculates the dimension of a barcode with the given message.voidgenerateBarcode(CanvasProvider canvas, String msg) Generates a barcode using the given Canvas to render the barcode to its output format.doublegetBarWidth(int width) Returns the effective width of a bar with a given logical width.intReturns the message encoding.intintGets the maxCols.intGets the maximum number of columns.intGets the minimum number of columns.intGets the minimum number of rows.doubleReturns the height of the rows.doubleGets the ratio of the barcode width to the height.booleanIndicates whether the generation of ECI sequences is enabled.voidsetColumns(int cols) Sets the number of data columns for the barcode.voidsetECIEnabled(boolean value) Controls whether ECI sequences are generated for the output encoding.voidsetEncoding(String encoding) Sets the message encoding.voidsetErrorCorrectionLevel(int level) Sets the error correction level for the barcode.voidsetMaxCols(int maxCols) Sets the maximum number of columns.voidsetMaxRows(int maxRows) Sets the maximum number of rows.voidsetMinCols(int minCols) Sets the minimum number of columns.voidsetMinRows(int minRows) Sets the minimum of rows.voidsetRowHeight(double height) Sets the height of the rows.voidsetWidthToHeightRatio(double widthToHeightRatio) Sets the ratio of the barcode width to the height.Methods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getBarHeight, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, getVerticalQuietZone, hasFontDescender, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone, setVerticalQuietZone
-
Field Details
-
DEFAULT_MODULE_WIDTH
protected static final double DEFAULT_MODULE_WIDTHThe default module width for PDF417. -
DEFAULT_X_TO_Y_FACTOR
protected static final int DEFAULT_X_TO_Y_FACTORThe default wide factor for PDF417.- See Also:
-
DEFAULT_COLUMN_COUNT
protected static final int DEFAULT_COLUMN_COUNTThe default column count for PDF417.- See Also:
-
DEFAULT_ERROR_CORRECTION_LEVEL
protected static final int DEFAULT_ERROR_CORRECTION_LEVELThe default error correction level for PDF417- See Also:
-
-
Constructor Details
-
PDF417Bean
public PDF417Bean()Create a new instance.
-
-
Method Details
-
getBarWidth
public double getBarWidth(int width) Description copied from class:AbstractBarcodeBeanReturns the effective width of a bar with a given logical width.- Specified by:
getBarWidthin classAbstractBarcodeBean- Parameters:
width- the logical width (1=narrow, 2=wide)- Returns:
- the effective width of a bar (in mm)
- See Also:
-
generateBarcode
Description copied from class:AbstractBarcodeBeanGenerates a barcode using the given Canvas to render the barcode to its output format.- Specified by:
generateBarcodein interfaceBarcodeGenerator- Specified by:
generateBarcodein classAbstractBarcodeBean- Parameters:
canvas- CanvasProvider that the barcode is to be rendered on.msg- message to encode- See Also:
-
calcDimensions
Description copied from class:AbstractBarcodeBeanCalculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.- Specified by:
calcDimensionsin interfaceBarcodeGenerator- Overrides:
calcDimensionsin classAbstractBarcodeBean- Parameters:
msg- message to use for calculation.- Returns:
- BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
- See Also:
-
getColumns
public int getColumns()- Returns:
- the number of data columns to produce
-
setColumns
public void setColumns(int cols) Sets the number of data columns for the barcode. The number of rows will automatically be determined based on the amount of data.- Parameters:
cols- the number of columns
-
getErrorCorrectionLevel
public int getErrorCorrectionLevel()- Returns:
- the error correction level (0-8)
-
setErrorCorrectionLevel
public void setErrorCorrectionLevel(int level) Sets the error correction level for the barcode.- Parameters:
level- the error correction level (a value between 0 and 8)
-
getMaxCols
public int getMaxCols()Gets the maxCols.- Returns:
- Returns the maxCols.
-
setMaxCols
public void setMaxCols(int maxCols) Sets the maximum number of columns.- Parameters:
maxCols- the maximum number of columns..
-
getMaxRows
public int getMaxRows()Gets the maximum number of columns.- Returns:
- Returns the maximum number of columns.
-
setMaxRows
public void setMaxRows(int maxRows) Sets the maximum number of rows.- Parameters:
maxRows- the maximum number of rows.
-
getMinCols
public int getMinCols()Gets the minimum number of columns.- Returns:
- Returns the minimum number of columns.
-
setMinCols
public void setMinCols(int minCols) Sets the minimum number of columns.- Parameters:
minCols- The minimum number of columns.
-
getMinRows
public int getMinRows()Gets the minimum number of rows.- Returns:
- Returns the minimum number of rows.
-
setMinRows
public void setMinRows(int minRows) Sets the minimum of rows.- Parameters:
minRows- the minimum of rows to set.
-
getRowHeight
public double getRowHeight()Returns the height of the rows.- Returns:
- the row height (in mm)
-
setRowHeight
public void setRowHeight(double height) Sets the height of the rows.- Parameters:
height- the height of the rows (in mm)
-
getWidthToHeightRatio
public double getWidthToHeightRatio()Gets the ratio of the barcode width to the height. e.g. a ratio of 5 means the width is 5 times the height- Returns:
- Returns the ratio of the barcode width to the height
-
setWidthToHeightRatio
public void setWidthToHeightRatio(double widthToHeightRatio) Sets the ratio of the barcode width to the height. e.g. a ratio of 5 means the width is 5 times the height- Parameters:
widthToHeightRatio- the ratio of the barcode width to the height
-
getEncoding
Returns the message encoding.- Returns:
- the message encoding (default is "ISO-8859-1")
-
setEncoding
Sets the message encoding. The value must conform to one of Java's encodings and have a mapping in the ECI registry.- Parameters:
encoding- the message encoding
-
isECIEnabled
public boolean isECIEnabled()Indicates whether the generation of ECI sequences is enabled.- Returns:
- true if generation of ECI sequences is enabled.
-
setECIEnabled
public void setECIEnabled(boolean value) Controls whether ECI sequences are generated for the output encoding.- Parameters:
value- true to enable the generation of ECI sequences
-