Created
September 14, 2011 07:35
-
-
Save jamesmorgan/1216038 to your computer and use it in GitHub Desktop.
Sample iText QRCode creation snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PushbuttonField barcodeButton = acroFields.getNewPushbuttonFromField("barcode_button"); | |
if(barcodeButton){ | |
// These settings are optional, null can be passed in as the four argument to BarcodeQRCode | |
Map<EncodeHintType, Object> hints = Maps.newHashMap(); | |
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); | |
hints.put(EncodeHintType.CHARACTER_SET, "ISO-8859-1"); | |
BarcodeQRCode qrcode = new BarcodeQRCode("SomeBarcodeData_123456789", 0, 0, hints); | |
barcodeButton.setLayout(PushbuttonField.LAYOUT_ICON_ONLY); | |
barcodeButton.setProportionalIcon(true); | |
barcodeButton.setBorderWidth(0); | |
barcodeButton.setVisibility(BaseField.VISIBLE); | |
barcodeButton.setImage(qrcode.getImage()); | |
acroFields.replacePushbuttonField("barcode_button", barcodeButton.getField()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment