Java QR Code Generator Size Setting Tutorial
sample source code to generate 2D QR Code images and adjust barcode size in Java
- QR Code barcode can be set in the center, right or left of the image
- QR Code image color can be changed with setting BackColor, ForeColor and TextColor
- Encoding QR Code valid data set to generate valid QR Code images in Java applications
- QR Code image width in Java can be changed with Y (bar height), barcodeHeight, topMargin and bottomMargin
- Unit of Measure can set the generated QR Code image in Inch, CM or Pixel
- Mature & Reliable Java QR Code generation library with latest barcode symbology ISO Standards
- Provide professional features to set inter-character space and wide narrow bar ratio for QR Code
- Completely developed in Java for any operating systems with Java Virtual Machine
- Draw high-quality QR Code barcodes in Java Class, J2SE applications by setting the size of barcode
- Detailed tutorial guide for Java QR Code generator is provided for your easier programming
QR Code, also known as Denso Barcode, QRCode, Quick Response Code, is a kind of 2D (two dimensional) barcode widely used today.
Onbarcode Java QR Code generator consits of other setting pages on how to set QR Code concerned properties to meet possible need on QR Code image or data encoding.
If you want to know more on the QR Code image adjustment in Java, please go to Java QR Code image setting;
If you want to know more on the QR Code valid character set and data length, please go to Java QR Code data encoding.
Change the QR Code Size in Java from Height, Width and Unit
QR Code Width Related Settings in Java
- Version: the overall demensions of the symbol(from 1 to 40), default is 1.
- X: Width of QR Code bar module (narrow bar), default is 1 pixel.
- barcodeWidth: Generated QR Code barcode image width.
- leftMargin: QR Code image left margin size.
- rightMargin: QR Code image right margin size.
QR Code Height Related Settings in Java
- Version: the overall demensions of the symbol(from 1 to 40), default is 1.
- X: Width of QR Code bar module (narrow bar), default is 1 pixel.
- barcodeHeight: Generated QR Code barcode image height.
- topMargin: QR Code image top margin size.
- bottomMargin: QR Code image bottom margin size.
Other QR Code Size Setting Properties in Java
- autoResize: Auto resize the generated QR Code barcode image, default is false.
- uom: Unit of meature for all size related settings in the Java barcode library. Valid values: 0: pixel; 1: inch; 2: cm.
Examples for QR Code Size Adjustment in Java Projects
Java QR Code generator supports all QR Code size related solution to specify the QR Code images generated in Java. After purchasing Java QR Code generator developer license, please install and set up it, then copy the following code into your Java IntelliJ IDEA:
Code39 barcode = new Code39();
barcode.setData("size-setting");
Then, modify the following properties you may need:
Version for QR Code in Java
As a popular 2D barcode symbology in Java programming, it can be set with version from 1 t 40 in the process of outputing QR Code in Java.
barcode.setVersion(22);
Unit of Measure for QR Code in Java
Java QR Code generator can generate and draw QR Code 2D barcode images with Pixel, Inch and Cm.
barcode.setUom(IBarcode.UOM_Inch);
Change the Width of QR Code with Java
barcode.setX(3f);
barcode.setLeftMargin(2f);
barcode.setRightMargin(2f);
//When setting the X and barcodeWidth at the same time, please set autoResize to be true to auto resize
QR Code in Java.
barcode.setautoResize(true);
During setting the QR Code width with the above properties, you need to pay attention that after you set a fixed bar width (X), an auto barcode width - minimum barcode width will be set in Java applications. However, if the set barcodeWidth value is less than the minimum barcode width, the created QR Code image width in Java will be the minimum value. If the set barcodeWith is larger than the minimum one, the extra width will be added on the right and left margins in Java.
Adjust the height of QR Code using Java
barcode.setX(3f);
barcode.setTopMargin(2f);
barcode.setBottomMargin(2f);
For QR Code image height adjustment, the situation is as same as QR Code image width adjustment.Java QR Code will automatically auro resize the QR Code image when the setting barcode height is conflict with bar module height - X