public class BarcodeQRCode extends Barcode2D
DEFAULT_MODULE_SIZE| Constructor and Description |
|---|
BarcodeQRCode()
Creates an instance of the
BarcodeQRCode class. |
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. |
PdfFormXObject |
createFormXObject(Color foreground,
float moduleSize,
PdfDocument document)
Creates a PdfFormXObject with the barcode.
|
PdfFormXObject |
createFormXObject(Color foreground,
PdfDocument document)
Creates a PdfFormXObject with the barcode.
|
Rectangle |
getBarcodeSize()
Gets the size of the barcode grid
|
Rectangle |
getBarcodeSize(float moduleSize)
Gets the barcode size
|
String |
getCode()
Gets the current data.
|
Map<EncodeHintType,Object> |
getHints() |
Rectangle |
placeBarcode(PdfCanvas canvas,
Color foreground)
Places the barcode in a
PdfCanvas. |
Rectangle |
placeBarcode(PdfCanvas canvas,
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()
BarcodeQRCode class.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 Rectangle getBarcodeSize()
getBarcodeSize in class Barcode2Dpublic Rectangle getBarcodeSize(float moduleSize)
moduleSize - The module sizepublic Rectangle placeBarcode(PdfCanvas canvas, 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 Rectangle placeBarcode(PdfCanvas canvas, 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 PdfFormXObject createFormXObject(Color foreground, PdfDocument document)
createFormXObject in class Barcode2Dforeground - the color of the pixels. It can be nulldocument - The documentpublic PdfFormXObject createFormXObject(Color foreground, float moduleSize, PdfDocument document)
foreground - The color of the pixels. It can be nullmoduleSize - The size of the pixels.document - The documentCopyright © 1998–2025 Apryse Group NV. All rights reserved.