com.itextpdf.text.pdf
Class BarcodeQRCode

java.lang.Object
  extended by com.itextpdf.text.pdf.BarcodeQRCode

public class BarcodeQRCode
extends Object

A QRCode implementation based on the zxing code.

Since:
5.0.2
Author:
Paulo Soares

Constructor Summary
BarcodeQRCode(String content, int width, int height, Map<EncodeHintType,Object> hints)
          Creates the QR barcode.
 
Method Summary
 Image createAwtImage(Color foreground, Color background)
          Creates a java.awt.Image.
 Image getImage()
          Gets an Image with the barcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarcodeQRCode

public BarcodeQRCode(String content,
                     int width,
                     int height,
                     Map<EncodeHintType,Object> hints)
Creates the QR barcode. The barcode is always created with the smallest possible size and is then stretched to the width and height given. Set the width and height to 1 to get an unscaled barcode.

Parameters:
content - the text to be encoded
width - the barcode width
height - the barcode height
hints - modifiers to change the way the barcode is create. 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. The default value is ISO-8859-1.
Throws:
WriterException
Method Detail

getImage

public Image getImage()
               throws BadElementException
Gets an Image with the barcode.

Returns:
the barcode Image
Throws:
BadElementException - on error

createAwtImage

public Image createAwtImage(Color foreground,
                            Color background)
Creates a java.awt.Image.

Parameters:
foreground - the color of the bars
background - the color of the background
Returns:
the image


Copyright © 2013. All Rights Reserved.