Java QR Code generator is a mature and reliable Java barcode generation component for creating QR Code barcodes in Java, Jasper Reports, iReport, and Eclipse BIRT projects. High-quality QR Code barcode images can be drawn and printed into GIF, BMP, PNG, JPEG/JPG & TIFF formats with Java QR Code barcode generator. Rich barcode options are provided to customize QR Code barcode properties in accordance with your needs.
QR Code information:
QR Code:one of the most important 2D barcode types, is made up of a square area with a white background and black modules in it. It was first developed by Deso Wave Corporation in 1994 for manufacturing, and quickly became popular because of its fast readability and large storage capacity.
Available encoding data:
numeric digits:Max. 7,089 characters
alphanumeric:Max.4,296 characters
binary(8bits): Max. 2,953 bytes
kanji/kanna: Max. 1,817 characters
Varaible data length
The structure of an QR Code:
1. Version information
2. Format information
3. Data and error correction keys
4. Required patterns:consists of position, alignment, timing
5. Quiet zone |
 |
1. Generate QR Code in Java class with the changing of barcode properties.
// Create Java QRCode object
QRCode barcode = new QRCode();
// Set QRCode data text to encode
barcode.setData("Create-QR-Code-in-Java");
// Generate QRCode barcode & print into Graphics2D object
barcode.drawBarcode("Java Graphics2D object");
// Generate QRCode barcode & encode into GIF format
barcode.drawBarcode("C://barcode-qrcode.gif");
// Generate QRCode barcode & encode into JPEG format
barcode.drawBarcode("C://barcode-qrcode.jpg");
2. Generate & encode QR Code to EPS with changing the values concerned.
// Create Java QRCode object
QRCode barcode = new QRCode();
// Set QRCode data text to encode
barcode.setData("Create QRCode in EPS");
// Generate QRCode barcode & encode into EPS
barcode.drawBarcode2EPS("C://barcode-qrcode.eps");
3. Generate & encode QR Code in html or jsp pages.
1. Under demo package, copy barcode folder and its contents to your tomcat.
2. Start tomcat, navigate to http://YourDomain:Port/barcode/barcode?DATA=QRCodeEncodingData&TYPE=qrcode
3. To create bar code images in html or jsp pages, you can insert a image tag (img) into your page.
For example, <img src="http://YourDomain:Port/barcode/barcode?DATA=QRCodeEncodingData&TYPE=qrcode" />
4. Two ways to set the width and height of generated barcode QR Code image.
1. Set the values of the barcodeWidth and barcodeHeight properties.
or
2. Set X (bar module width) and Y (bar module height) values
Method
// generate barcode and output to OutputStream object
public boolean drawBarcode(OutputStream outputStream) throws Exception
// generate barcode into a new BufferedImage object
public BufferedImage drawBarcode() throws Exception
/*
Use this method to generate barcode, and save into gif or jpeg files
1. to save into gif file, filename ends with ".gif", like "c:\\barcode.gif"
2. to save into jpeg file, filename ends with ".jpg", like "c:\\barcode.jpg"
*/
public byte[] drawBarcodeToBytes() throws Exception
public boolean drawBarcode(String imageFile) throws Exception
// Generate barcode and save into EPS file, the filename must ends with ".eps"
public void drawBarcode2EPS(String filename) throws Exception
// Generate barcode on Graphics2D object within certain area
public void drawBarcode(Graphics2D g, Rectangle2D rectangle) throws Exception