Barcode-Lib4J requires Java 9+

Java Class «ImplEAN14»  –  Generate EAN-14 Barcode

All Implemented Interfaces:
Cloneable

public class ImplEAN14 extends ImplEAN128
Implementation of EAN-14 (also known as GTIN-14) using GS1-128. To generate instances, please use one of the newInstance static methods in the Barcode class.

This convenience class generates a GS1-128 barcode that contains a 14-digit GTIN as the sole data element. It automatically includes the Application Identifier prefix '01' in both the barcode and the human readable text line, allowing you to specify only the GTIN number itself.

Note: Encoding the same GTIN number with this class and with the GS1-128 implementation will produce exactly the same barcode.

  • Method Details

    • setContent

      public void setContent(String content, boolean autoComplete, boolean appendOptionalChecksum) throws BarcodeException
      Sets the GTIN number to be encoded in the barcode.

      The number must be either 14 (with check digit) or 13 (without check digit) in length.

      • If the number contains 14 digits, the 14th digit is checked to see if it is a valid check digit. If the check digit is invalid, a BarcodeException is thrown.
      • If the number contains 13 digits and autoComplete is set to true, the method calculates the missing check digit and appends it to the specified number. If autoComplete is set to false, a BarcodeException is thrown.
      Overrides:
      setContent in class ImplEAN128
      Parameters:
      content - the GTIN number to be encoded in the barcode
      autoComplete - whether to automatically calculate and append a check digit if it is missing
      appendOptionalChecksum - has no function, as GTIN 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