public class BarcodeQRCode extends Barcode2D
DEFAULT_MODULE_SIZE| Constructor and Description |
|---|
BarcodeQRCode() |
BarcodeQRCode(String content)
Creates the QR barcode with default error correction level (ErrorCorrectionLevel.L)
and default character set (ISO-8859-1).
|
BarcodeQRCode(String code,
Map<EncodeHintType,Object> hints)
Creates the QR barcode.
|
| Modifier and Type | Method and Description |
|---|---|
Image |
createAwtImage(Color foreground,
Color background)
Creates a
java.awt.Image. |
com.itextpdf.kernel.pdf.xobject.PdfFormXObject |
createFormXObject(com.itextpdf.kernel.colors.Color foreground,
float moduleSize,
com.itextpdf.kernel.pdf.PdfDocument document)
Creates a PdfFormXObject with the barcode.
|
com.itextpdf.kernel.pdf.xobject.PdfFormXObject |
createFormXObject(com.itextpdf.kernel.colors.Color foreground,
com.itextpdf.kernel.pdf.PdfDocument document)
Creates a PdfFormXObject with the barcode.
|
com.itextpdf.kernel.geom.Rectangle |
getBarcodeSize()
Gets the size of the barcode grid
|
com.itextpdf.kernel.geom.Rectangle |
getBarcodeSize(float moduleSize)
Gets the barcode size
|
String |
getCode()
Gets the current data.
|
Map<EncodeHintType,Object> |
getHints() |
com.itextpdf.kernel.geom.Rectangle |
placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color foreground)
Places the barcode in a
PdfCanvas. |
com.itextpdf.kernel.geom.Rectangle |
placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color foreground,
float moduleSide)
* Places the barcode in a
PdfCanvas. |
void |
regenerate()
Regenerates barcode after changes in hints or code.
|
void |
setCode(String code)
Sets the data to be encoded by the barcode.
|
void |
setHints(Map<EncodeHintType,Object> hints) |
createFormXObjectpublic BarcodeQRCode(String code, Map<EncodeHintType,Object> hints)
code - the text to be encodedhints - barcode hints. See #setHints for description.public BarcodeQRCode(String content)
content - the text to be encodedpublic BarcodeQRCode()
public String getCode()
public void setCode(String code)
code - The data to encodepublic Map<EncodeHintType,Object> getHints()
public void setHints(Map<EncodeHintType,Object> hints)
hints - modifiers to change the way the barcode is created. They can be EncodeHintType.ERROR_CORRECTION
and EncodeHintType.CHARACTER_SET. For EncodeHintType.ERROR_CORRECTION the values can be ErrorCorrectionLevel.L, M, Q, H.
For EncodeHintType.CHARACTER_SET the values are strings and can be Cp437, Shift_JIS and ISO-8859-1 to ISO-8859-16.
You can also use UTF-8, but correct behaviour is not guaranteed as Unicode is not supported in QRCodes.
The default value is ISO-8859-1.public void regenerate()
public com.itextpdf.kernel.geom.Rectangle getBarcodeSize()
getBarcodeSize in class Barcode2Dpublic com.itextpdf.kernel.geom.Rectangle getBarcodeSize(float moduleSize)
moduleSize - The module sizepublic com.itextpdf.kernel.geom.Rectangle placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color foreground)
Barcode2DPdfCanvas. The
barcode is always placed at coordinates (0, 0). Use the
translation matrix to move it elsewhere.placeBarcode in class Barcode2Dcanvas - the PdfCanvas where the barcode will be placedforeground - the foreground color. It can be nullpublic com.itextpdf.kernel.geom.Rectangle placeBarcode(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas,
com.itextpdf.kernel.colors.Color foreground,
float moduleSide)
PdfCanvas. The
barcode is always placed at coordinates (0, 0). Use the
translation matrix to move it elsewhere.canvas - the PdfCanvas where the barcode will be placedforeground - the foreground color. It can be nullmoduleSide - the size of the square grid cellpublic com.itextpdf.kernel.pdf.xobject.PdfFormXObject createFormXObject(com.itextpdf.kernel.colors.Color foreground,
com.itextpdf.kernel.pdf.PdfDocument document)
createFormXObject in class Barcode2Dforeground - the color of the pixels. It can be nulldocument - The documentpublic com.itextpdf.kernel.pdf.xobject.PdfFormXObject createFormXObject(com.itextpdf.kernel.colors.Color foreground,
float moduleSize,
com.itextpdf.kernel.pdf.PdfDocument document)
foreground - The color of the pixels. It can be nullmoduleSize - The size of the pixels.document - The documentCopyright © 1998–2019 iText Group NV. All rights reserved.