Package com.itextpdf.barcodes
Class Barcode2D
- java.lang.Object
-
- com.itextpdf.barcodes.Barcode2D
-
- Direct Known Subclasses:
BarcodeDataMatrix,BarcodePDF417,BarcodeQRCode
public abstract class Barcode2D extends java.lang.ObjectThis 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 Summary
Fields Modifier and Type Field Description protected static floatDEFAULT_MODULE_SIZE
-
Constructor Summary
Constructors Constructor Description Barcode2D()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract PdfFormXObjectcreateFormXObject(Color foreground, PdfDocument document)Creates a PdfFormXObject with the barcode.PdfFormXObjectcreateFormXObject(PdfDocument document)Creates a PdfFormXObject with the barcode.abstract RectanglegetBarcodeSize()Gets the maximum area that the barcode and the text, if any, will occupy.abstract RectangleplaceBarcode(PdfCanvas canvas, Color foreground)Places the barcode in aPdfCanvas.
-
-
-
Field Detail
-
DEFAULT_MODULE_SIZE
protected static final float DEFAULT_MODULE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 aPdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.- Parameters:
canvas- thePdfCanvaswhere the barcode will be placedforeground- the foreground color. It can benull- 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 benulldocument- The document- Returns:
- the XObject.
-
-