Package com.itextpdf.barcodes.qrcode
Class QRCodeWriter
java.lang.Object
com.itextpdf.barcodes.qrcode.QRCodeWriter
This object renders a QR Code as a ByteMatrix 2D array of greyscale values.
- Author:
- dswitkin@google.com (Daniel Switkin)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionEncode 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?encode
(String contents, int width, int height, Map<EncodeHintType, Object> hints) Encode a string into a QR code with dimensions width x height.
-
Constructor Details
-
QRCodeWriter
public QRCodeWriter()
-
-
Method Details
-
encode
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 code -
width
- width of the QR-code -
height
- 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(String contents, int width, int height, Map<EncodeHintType, Object> hints) throws WriterExceptionEncode 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 code -
width
- width of the QR-code -
height
- height of the QR-code -
hints
- 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
-