Barcode-Lib4J requires Java 11+
Package de.vwsoft.barcodelib4j.oned
Java Class «ImplEAN13» – Barcode «EAN-13»
java.lang.Object
de.vwsoft.barcodelib4j.oned.Barcode
de.vwsoft.barcodelib4j.oned.UPCEANFamily
de.vwsoft.barcodelib4j.oned.ImplEAN13
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ImplISBN13,ImplISMN
Implementation of EAN-13 (also known as GTIN-13). To create instances, use one of the
newInstance static methods in the Barcode class.-
Method Summary
Modifier and TypeMethodDescriptionvoidsetContent(String content, boolean autoComplete, boolean appendOptionalChecksum) Sets the EAN-13 number to be encoded in the barcode.Methods inherited from class de.vwsoft.barcodelib4j.oned.UPCEANFamily
getAddOn, setAddOnMethods inherited from class de.vwsoft.barcodelib4j.oned.Barcode
clone, draw, draw, getContent, getFont, getRatio, getText, getTextOffset, isFontSizeAdjusted, isOptionalChecksumVisible, isTextOnTop, isTextVisible, newInstance, newInstance, setCustomText, setFont, setFontSizeAdjusted, setOptionalChecksumVisible, setRatio, setTextOffset, setTextOnTop, setTextVisible, supportsAutoCompletion, supportsOptionalChecksum, supportsRatio
-
Method Details
-
setContent
public void setContent(String content, boolean autoComplete, boolean appendOptionalChecksum) throws BarcodeException Sets the EAN-13 number to be encoded in the barcode.The number must be either 13 (with check digit) or 12 (without check digit) in length.
- If the number contains 13 digits, the 13th digit is checked to see if it is a valid check
digit according to the EAN-13 standard. If the check digit is invalid, a
BarcodeExceptionis thrown. - If the number contains 12 digits and
autoCompleteis set totrue, the method calculates the missing check digit and appends it to the specified number. IfautoCompleteis set tofalse, aBarcodeExceptionis thrown.
- Specified by:
setContentin classBarcode- Parameters:
content- the EAN-13 number to be encoded in the barcodeautoComplete- whether to automatically calculate and append a check digit if it is missingappendOptionalChecksum- has no function, as EAN-13 uses a fixed check digit which is not optional- Throws:
BarcodeException- if the content is empty, contains non-numeric characters, is of invalid length, or has an invalid check digit
- If the number contains 13 digits, the 13th digit is checked to see if it is a valid check
digit according to the EAN-13 standard. If the check digit is invalid, a
-