Barcode-Lib4J requires Java 9+

Java Class «ImplISBN13»  –  Generate ISBN-13 Barcode

All Implemented Interfaces:
Cloneable

public class ImplISBN13 extends ImplEAN13
Implementation of ISBN-13 (International Standard Book Number). To generate instances, please use one of the 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.
The components are separated by hyphens, for example: 978-1-2345-6789-7.

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 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 to true, the method calculates and appends the correct check digit; otherwise, a BarcodeException is thrown.

      Overrides:
      setContent in class ImplEAN13
      Parameters:
      content - the ISBN-13 number to be encoded
      autoComplete - whether to automatically calculate the check digit if it is missing
      appendOptionalChecksum - 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 if autoComplete is false and the content is missing a check digit.