Class EAN13Writer

  • All Implemented Interfaces:
    Writer

    public final class EAN13Writer
    extends UPCEANWriter
    This object renders an EAN13 code as a BitMatrix.
    • Constructor Detail

      • EAN13Writer

        public EAN13Writer()
    • Method Detail

      • encode

        public BitMatrix encode​(java.lang.String contents,
                                BarcodeFormat format,
                                int width,
                                int height,
                                java.util.Map<EncodeHintType,​?> hints)
                         throws WriterException
        Description copied from class: OneDimensionalCodeWriter
        Encode the contents following specified format. width and height are required size. This method may return bigger size BitMatrix when specified size is too small. The user can set both width and height to zero to get minimum size barcode. If negative value is set to width or height, IllegalArgumentException is thrown.
        Specified by:
        encode in interface Writer
        Overrides:
        encode in class OneDimensionalCodeWriter
        Parameters:
        contents - The contents to encode in the barcode
        format - The barcode format to generate
        width - The preferred width in pixels
        height - The preferred height in pixels
        hints - Additional parameters to supply to the encoder
        Returns:
        BitMatrix representing encoded barcode image
        Throws:
        WriterException - if contents cannot be encoded legally in a format
      • encode

        public boolean[] encode​(java.lang.String contents)
        Description copied from class: OneDimensionalCodeWriter
        Encode the contents to boolean array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included.
        Specified by:
        encode in class OneDimensionalCodeWriter
        Parameters:
        contents - barcode contents to encode
        Returns:
        a boolean[] of horizontal pixels (false = white, true = black)