Class Barcode2D

java.lang.Object
com.itextpdf.barcodes.Barcode2D
Direct Known Subclasses:
BarcodeDataMatrix, BarcodePDF417, BarcodeQRCode

public abstract class Barcode2D extends Object
This is a class that is used to implement the logic common to all 2D barcodes. A 2D barcode is a barcode with two dimensions; this means that data can be encoded vertically and horizontally.
  • Field Details

  • Constructor Details

    • Barcode2D

      public Barcode2D()
  • Method Details

    • getBarcodeSize

      public abstract Rectangle getBarcodeSize()
      Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0).
      Returns:
      the size the barcode occupies.
    • placeBarcode

      public abstract Rectangle placeBarcode (PdfCanvas canvas, Color foreground)
      Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.
      Parameters:
      canvas - the PdfCanvas where the barcode will be placed
      foreground - the foreground color. It can be null
      Returns:
      the dimensions the barcode occupies
    • createFormXObject

      public PdfFormXObject createFormXObject (PdfDocument document)
      Creates a PdfFormXObject with the barcode. Default foreground color will be used.
      Parameters:
      document - The document
      Returns:
      the XObject.
    • createFormXObject

      public abstract PdfFormXObject createFormXObject (Color foreground, PdfDocument document)
      Creates a PdfFormXObject with the barcode.
      Parameters:
      foreground - The color of the pixels. It can be null
      document - The document
      Returns:
      the XObject.