Package com.itextpdf.barcodes.qrcode
Class QRCodeWriter
- java.lang.Object
-
- com.itextpdf.barcodes.qrcode.QRCodeWriter
-
public final class QRCodeWriter extends java.lang.Object
This object renders a QR Code as a ByteMatrix 2D array of greyscale values.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
QUIET_ZONE_SIZE
-
Constructor Summary
Constructors Constructor Description QRCodeWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteMatrix
encode(java.lang.String contents, int width, int height)
Encode a string into a QR code with dimensions width x height, using error-correction level L and the smallest version for which he contents fit into the QR-code?ByteMatrix
encode(java.lang.String contents, int width, int height, java.util.Map<EncodeHintType,java.lang.Object> hints)
Encode a string into a QR code with dimensions width x height.private static ByteMatrix
renderResult(QRCode code, int width, int height)
private static void
setRowColor(byte[] row, byte value)
-
-
-
Field Detail
-
QUIET_ZONE_SIZE
private static final int QUIET_ZONE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
encode
public ByteMatrix encode(java.lang.String contents, int width, int height) throws WriterException
Encode a string into a QR code with dimensions width x height, using error-correction level L and the smallest version for which he contents fit into the QR-code?- Parameters:
contents
- String to encode into the QR codewidth
- width of the QR-codeheight
- height of the QR-code- Returns:
- 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix
- Throws:
WriterException
- exception is thrown in case an error occurs when encoding a barcode using the Writer framework
-
encode
public ByteMatrix encode(java.lang.String contents, int width, int height, java.util.Map<EncodeHintType,java.lang.Object> hints) throws WriterException
Encode a string into a QR code with dimensions width x height. Hints contains suggestions for error-correction level and version. The default error-correction level is L, the default version is the smallest version for which the contents will fit into the QR-code.- Parameters:
contents
- String to encode into the QR codewidth
- width of the QR-codeheight
- height of the QR-codehints
- Map containing suggestions for error-correction level and version- Returns:
- 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix
- Throws:
WriterException
- exception is thrown in case an error occurs when encoding a barcode using the Writer framework
-
renderResult
private static ByteMatrix renderResult(QRCode code, int width, int height)
-
setRowColor
private static void setRowColor(byte[] row, byte value)
-
-