Java QR Code Generator Image Setting Tutorial
sample source code to generate QR Code in png, jpeg, etc. image formats in Java
- QR Code image width in Java can be changed with Y (bar height), barcodeHeight, topMargin and bottomMargin
- Easy to generate QR Code images in Java Reports, such as Jasper Report, iReport, Eclipse BIRT and Oracle Reports
- Check sum digit of QR Code image can be automatically computed
- Detailed tutorial guide for Java QR Code generator is provided for your easier programming
- Servlets, Applets, JavaBean and class library are provided in QR Code generator for Java
- Permanent license with the purchase of the developer license
- Resolution setting and margin setting to ensure high readability for QR Code
- Version 1-40 of QR Code are supported
QR Code, also known as Denso Barcode, QRCode, Quick Response Code, is a kind of 2D (two dimensional) barcode widely used today.
Java 2D Barcode Generator consists of three important barcode types which are QR Code in Java, PDF 417 in Java and Data Matrix in Java, all of which supports all detailed guide for data encoding and size seting except image setting:
QR Code Size Setting for Java provides various samples on how to set X, Y, barcodeWidth, barcodeHeight and other properties;
QR Code Data Encoding for Java provides various samples on how to QR Code valid data set and data length.
Java QR Code Image Setting Aspects and Implementation
Java QR Code image setting can be divided into image placement, image color, image resolution and image four aspects to impelment for superb quality 2D QR Code image using Java.
QRCode barcode = new QRCode();
barcode.setData("QR Code");
QR Code Image Placement Setting in Java
QR Code image placement refers to two aspects which are rotate and barlignment in Java development.
//For rotating QR Code image, there are four choices which are 0 (IBarcode.ROTATE_0); 1 (IBarcode.ROTATE_90);
2 (IBarcode.ROTATE_180); 3 (IBarcode.ROTATE_270); default is 0
barcode.setRotate(IBarcode.ROTATE_10);
//For QR Code barlignment, you can put the QR Code barcode in the left , right and center inside the image
in Java. 1: center, 2: right; default is 1: center.Default is 1: center
barcode.setbarAlignment(1(center));
Java QR Code Image Color Setting
The color of 2D barcode - QR Code generated in Java refer to two aspects which are bacground color and foreground color by setting to any human-seen color
barcode.setbackColor(white);
barcode.setforeColor(yellow);
Java QR Code Image Resolution Setting
QR Code image resolution can be set to be any fixed value with QR Code generation library:
barcode.setResolution(72);
Java QR Code Image Format Setting
Java QR Code generation control supports generating high quality QR Code image with common used image formats like png, tiff, gif, jpeg and bmp. A sample code is below for your easier implementation with just copying and changing to the target format.
//For bmp image format
barcode.drawBarcode("C:\\QR Code.bmp");
//For png format
barcode.drawBarcode("C:\\QR Code.png");
//For jpeg format
barcode.drawBarcode("C:\\QR Code.jpeg");
//For tiff format
barcode.drawBarcode("C:\\QR Code.tiff");
//For gif format
barcode.drawBarcode("C:\\QR Code.gif");