Class BarcodePostnet


public class BarcodePostnet extends Barcode1D
  • Field Details


      public static int TYPE_POSTNET

      public static int TYPE_PLANET
  • Constructor Details

    • BarcodePostnet

      public BarcodePostnet (PdfDocument document)
  • Method Details

    • getBarsPostnet

      public static byte[] getBarsPostnet (String text)
      Creates the bars for Postnet.
      text - the code to be created without checksum
      the bars
    • getBarcodeSize

      public Rectangle getBarcodeSize()
      Description copied from class: Barcode1D
      Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0).
      Specified by:
      getBarcodeSize in class Barcode1D
      the size the barcode occupies.
    • fitWidth

      public void fitWidth (float width)
      Description copied from class: Barcode1D
      Make the barcode occupy the specified width. Usually this is achieved by adjusting bar widths.
      fitWidth in class Barcode1D
      width - The width
    • placeBarcode

      public Rectangle placeBarcode (PdfCanvas canvas, Color barColor, Color textColor)
      Description copied from class: Barcode1D
      Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.

      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 Barcode1D
      canvas - the PdfCanvas where the barcode will be placed
      barColor - the color of the bars. It can be null
      textColor - the color of the text. It can be null
      the dimensions the barcode occupies
    • createAwtImage

      public Image createAwtImage (Color foreground, Color background)
      Description copied from class: Barcode1D
      Creates a java.awt.Image. This image only contains the bars without any text.
      Specified by:
      createAwtImage in class Barcode1D
      foreground - the color of the bars. If null defaults to Barcode1D.DEFAULT_BAR_FOREGROUND_COLOR
      background - the color of the background. If null defaults to Barcode1D.DEFAULT_BAR_BACKGROUND_COLOR
      the image