Class BarcodeInter25


  • public class BarcodeInter25
    extends Barcode
    Implements the code interleaved 2 of 5. The text can include non numeric characters that are printed but do not generate bars. The default parameters are:
     x = 1f;
     n = 2;
     font=new Font("Helvetica", Font.PLAIN, 20)
     textAlignment = ALIGN_CENTER;
     generateChecksum = false;
     checksumText = false;
     transparent = true;
     shotText = true
     
    This class is based on iText "A Free Java-PDF library by Bruno Lowagie and Paulo Soares" using the Mozilla Public License(MPL)
    • Constructor Detail

      • BarcodeInter25

        public BarcodeInter25()
        Creates new BarcodeInter25
    • Method Detail

      • getBarcodeWidth

        public int getBarcodeWidth()
        Gets the maximum width that the barcode will occupy. The lower left corner is always (0, 0).
        Specified by:
        getBarcodeWidth in class Barcode
        Returns:
        the size the barcode occupies.
      • getBarsInter25

        public static byte[] getBarsInter25​(java.lang.String text)
        Creates the bars for the barcode.
        Parameters:
        text - the text. It can contain non numeric characters
        Returns:
        the barcode
      • getChecksum

        public static char getChecksum​(java.lang.String text)
        Calculates the checksum.
        Parameters:
        text - the numeric text
        Returns:
        the checksum
      • keepNumbers

        public static java.lang.String keepNumbers​(java.lang.String text)
        Deletes all the non numeric characters from text.
        Parameters:
        text - the text
        Returns:
        a String with only numeric characters
      • placeBarcode

        public void placeBarcode​(Image image,
                                 int barColor,
                                 int textColor)
        Places the barcode in a Image. The The bars and text are written in the following colors:

        barColor

        textColor

        Result

        null

        null

        bars and text painted with current fill color

        barColor

        null

        bars and text painted with barColor

        null

        textColor

        bars painted with current color
        text painted with textColor

        barColor

        textColor

        bars painted with barColor
        text painted with textColor

        Specified by:
        placeBarcode in class Barcode
        Parameters:
        image - the Image where the barcode will be placed
        barColor - the color of the bars. It can be -1
        textColor - the color of the text. It can be -1