Java Class «ImplISBN13» – Generate ISBN-13 Barcode
- All Implemented Interfaces:
Cloneable
newInstance
static methods in the Barcode
class.
ISBN-13 barcodes are based on the GTIN (Global Trade Item Number) system and use the EAN-13 barcode symbology (also known as GTIN-13). ISBN-13 is primarily used for books and other publications, ensuring accurate tracking and identification within the global trade system.
An ISBN-13 number consists of the following components:
- A prefix of "978" or "979",
- A group identifier,
- A publisher code,
- An item number, and
- A single check digit at the end.
Note: The human readable ISBN-13 number is printed below the barcode without hyphens and above the barcode with hyphens. The latter instance is drawn outside the barcode's bounding box, which may require additional space and a downward shift of the Y-position.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setContent
(String content, boolean autoComplete, boolean appendOptionalChecksum) Sets the ISBN-13 number to be encoded in the barcode.Methods inherited from class de.vwsoft.barcodelib4j.oned.LineageUPC
getAddOn, setAddOn
Methods inherited from class de.vwsoft.barcodelib4j.oned.Barcode
clone, draw, draw, getContent, getFont, getRatio, getText, getTextOffset, isFontSizeAdjusted, isOptionalChecksumVisible, isTextOnTop, isTextVisible, newInstance, newInstance, 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 ISBN-13 number to be encoded in the barcode.The input must conform to the ISBN-13 structure, consisting of only numeric characters and hyphens ('-'). The input must include a prefix, group, publisher, and item number. For example:
978-1-2345-6789-7
If the provided ISBN-13 number contains a check digit (at the end), the method validates it according to ISBN-13 rules.If the provided ISBN-13 number does not contain a check digit and the
autoComplete
flag is set totrue
, the method calculates and appends the correct check digit; otherwise, aBarcodeException
is thrown.- Overrides:
setContent
in classImplEAN13
- Parameters:
content
- the ISBN-13 number to be encodedautoComplete
- whether to automatically calculate the check digit if it is missingappendOptionalChecksum
- has no function, as ISBN-13 uses a fixed check digit which is not optional- Throws:
BarcodeException
- if the content is empty, does not conform to the proper ISBN-13 format, contains an invalid check digit, or ifautoComplete
isfalse
and the content is missing a check digit.
-