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 .
|
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) |
createFormXObject
public BarcodeQRCode(String code, Map<EncodeHintType,Object> hints)
code
- the text to be encoded
hints
- barcode hints. See #setHints for description.
public BarcodeQRCode(String content)
content
- the text to be encoded
public BarcodeQRCode()
public String getCode()
public void setCode(String code)
public 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 Barcode2D
public Rectangle getBarcodeSize(float moduleSize)
public Rectangle placeBarcode(PdfCanvas canvas, Color foreground)
Barcode2D
PdfCanvas
. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.
placeBarcode
in class Barcode2D
canvas
- the PdfCanvas
where the barcode will be placed
foreground
- the foreground color. It can be null
public 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 placed
foreground
- the foreground color. It can be null
moduleSide
- the size of the square grid cell
public PdfFormXObject createFormXObject(Color foreground, PdfDocument document)
createFormXObject
in class Barcode2D
foreground
- the color of the pixels. It can be null
public PdfFormXObject createFormXObject(Color foreground, float moduleSize, PdfDocument document)
foreground
- the color of the pixels. It can be null
moduleSize
- the size of the pixels.
Copyright © 1998–2017 iText Group NV. All rights reserved.