KA.Barcode for Java
Guide for Encoding Alphanumeric Data in Java Data Matrix
Complete Data Matrix source code to generate, print EAN-13 images using Barcode Generator for Java Control
Data Matrix Generator for Java Overview
  • Java Server Side projects (JSP, Servlet, EJB, J2EE, Web Service) can be easily integrated
  • Java Client applications (Java Class, Swing, Applet, Java Bean and J2SE) are supported
  • Easy to generate Data Matrix images in Java Reports, such as Jasper Report, iReport, Eclipse BIRT and Oracle Reports
  • A Srvlet, Applet, JavaBean and class library are contained in the Java Data Matrix generator package
  • Left margin, right margin, top margin, bottom margin, wide to narrow ratio and text margin can change the size of Data Matrix image in Java projects
  • Show text can enable or disenable with Java Data Matrix generator
  • Valid character set and available data length can be referred in the Data Matrix page
Data Matrix for Java Valid Character Set
  • all 128 characters of ASCII
  • values 128-255 in accordance with ISO 8859-1 which referred to as extended ASCII.
  • Related Data Matrix Java Generation Setting Guide
    Excluding Java Data Matrix Size Setting, Data Matrix generator for Java provides other concerned Data Matrix generation setting properties for adjust the image and size:
    Encode Valid Data Mode in Variable length for Data Matrix in Java
    For valid Data Matrix encoding data in Java, Data Matrix generator in Java supports 7 data modes for Data Matrix:
    • 0(M_AUTO) - the default encoding format by Barcode Library.
    • 1(M_ASCII) - for contains ASCII characters (0-127).
    • 2(M_C40 )- for numeric and upper case characters.
    • 3(M_TEXT) - for numeric and lower case characters.
    • 4(M_X12) - for the standard ANSI X12 electronic data interchange characters.
    • 5(M_EDIFACT) - for 63 ASCII values (values from 32 to 94) plus an Unlatch character (binary 011111).
    • 6(M_BASE256 ) - for 8 bit values.
    An example code is below:
    DataMatrix barcode = new DataMatrix();
    barcode.setdataMode(0(M_AUTO));
    barcode.setdata(14234567889);
    Encode GS1 compatible Data Matrix in Java
    To encode GS1 compatible Data Matrix in Java, you need to set property fnc1Mode value (default is IBarcode.FNC1_NONE (0)) to IBarcode.FNC1_ENABLE (1), to indicate that the generated data matrix is GS1 compatible. Then there are two ways to input GS1 AI elements:
    • Parenthesis: to use parenthesis to indicate an AI code. Eg.
    • For example:
      DataMatrix barcode = new DataMatrix();
      barcode.setdataMode(0(M_AUTO));
      barcode.set fnc1Mode(IBarcode.FNC1_ENABLE (1));
      barcode.setcode((12)1234567)
    • Escape Tilde: to use ~ai* to indicate an AI while * is digit number of the AI (from 2 ~ 7). Eg. ~ai20112345 same as (01)12345
    • For example:
      DataMatrix barcode = new DataMatrix();
      barcode.setdataMode(0(M_AUTO));
      barcode.set fnc1Mode(IBarcode.FNC1_ENABLE (1));
      barcode.setcode(~ai20112345)