Class EAN128Bean
java.lang.Object
org.krysalis.barcode4j.impl.AbstractBarcodeBean
org.krysalis.barcode4j.impl.code128.Code128Bean
org.krysalis.barcode4j.impl.code128.EAN128Bean
- All Implemented Interfaces:
BarcodeGenerator
This class is an implementation of the Code 128 barcode.
- Author:
- Jeremias Maerki, Dietmar Bürkle
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charDefines the default character for the check digit markerstatic final charDefines the default group separator characterFields inherited from class org.krysalis.barcode4j.impl.code128.Code128Bean
DEFAULT_CODESET, DEFAULT_MODULE_WIDTHFields 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.charReturns the current checksum mode.charbooleanvoidsetCheckDigitMarker(char c) Sets the character that will be used as the check digit marker.voidsetChecksumMode(ChecksumMode mode) Sets the checksum modevoidsetGroupSeparator(char c) Sets the group separator character.voidsetOmitBrackets(boolean b) Indicates whether brackets should be used in the human-readable part around the AIs.voidsetTemplate(String string) Sets the message template with the fields for the EAN message.Methods inherited from class org.krysalis.barcode4j.impl.code128.Code128Bean
getBarWidth, getCodeset, hasFontDescender, setCodesetMethods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getBarHeight, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, getVerticalQuietZone, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone, setVerticalQuietZone
-
Field Details
-
DEFAULT_GROUP_SEPARATOR
public static final char DEFAULT_GROUP_SEPARATORDefines the default group separator character- See Also:
-
DEFAULT_CHECK_DIGIT_MARKER
public static final char DEFAULT_CHECK_DIGIT_MARKERDefines the default character for the check digit marker- See Also:
-
-
Constructor Details
-
EAN128Bean
public EAN128Bean()Create a new instance.
-
-
Method Details
-
generateBarcode
Description copied from class:Code128BeanGenerates a barcode using the given Canvas to render the barcode to its output format.- Specified by:
generateBarcodein interfaceBarcodeGenerator- Overrides:
generateBarcodein classCode128Bean- Parameters:
canvas- CanvasProvider that the barcode is to be rendered on.msg- message to encode- See Also:
-
calcDimensions
Description copied from class:Code128BeanCalculates 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 classCode128Bean- Parameters:
msg- message to use for calculation.- Returns:
- BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
- See Also:
-
getChecksumMode
Returns the current checksum mode.- Returns:
- ChecksumMode the checksum mode
-
setChecksumMode
Sets the checksum mode- Parameters:
mode- the checksum mode
-
getGroupSeparator
public char getGroupSeparator()- Returns:
- the group separator character
-
setGroupSeparator
public void setGroupSeparator(char c) Sets the group separator character. Normally, either ASCII GS or 0xF1 is used.- Parameters:
c- the group separator character.
-
getTemplate
- Returns:
- the message template with the fields for the EAN message
-
setTemplate
Sets the message template with the fields for the EAN message.The format of the templates here is a repeating set of AI number (in brackets) followed by a field description. The allowed data types are "n" (numeric), "an" (alpha-numeric), "d" (date) and "cd" (check digit). Examples: "n13" defines a numeric field with exactly 13 digits. "n13+cd" defines a numeric field with exactly 13 digits plus a check digit. "an1-9" defines an alpha-numeric field with 1 to 9 characters.
- Parameters:
string- a template like "(01)n13+cd(421)n3+an1-9(10)an1-20"
-
getCheckDigitMarker
public char getCheckDigitMarker()- Returns:
- the character used as the check digit marker.
-
setCheckDigitMarker
public void setCheckDigitMarker(char c) Sets the character that will be used as the check digit marker.- Parameters:
c- the character for the check digit marker
-
isOmitBrackets
public boolean isOmitBrackets()- Returns:
- true if the brackets in the human-readable part should be omitted
-
setOmitBrackets
public void setOmitBrackets(boolean b) Indicates whether brackets should be used in the human-readable part around the AIs.- Parameters:
b- true if the brackets in the human-readable part should be omitted
-