Skip to content

Instantly share code, notes, and snippets.

@jamesmorgan
Created September 14, 2011 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmorgan/1216038 to your computer and use it in GitHub Desktop.
Save jamesmorgan/1216038 to your computer and use it in GitHub Desktop.
Sample iText QRCode creation snippet
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