KA.Barcode for Java
Guide for Resizing QR Code Barcodes in Java
Complete Java source code to generate, print QR Code images and change barcode size with Java Control
QR Code Barcode Generator for Java Overview
  • Pre-configured industry standards QR Code allow any untrained users to insert QR Code in Java
  • Java Server Side projects (JSP, Servlet, EJB, J2EE, Web Service) can be easily integrated
  • Provide professional features to set inter-character space and wide narrow bar ratio for QR Code
  • Applet allows QR Code easily integrated into web pages
  • Simple to change the height of QR Code barcode image with setting the Y(height of bar module) or BarCodeHeight.
  • Java QR Code generation component supports rotating QR Code image with 0, 90, 180, 270 angles
  • Common-used image formats are valid here, which are png, tiff, gif, jpeg and bmp
  • Encode QR Code valid data with valid data length to generate QR Code images in Java
Related QR Code Java Generation Setting Guide
QR Code, is also named as Denso Barcode, QRCode, Quick Response Code, JIS X0510, ISO/IE18004. Excluding Java QR Code Size Setting, KeepAutomation provides other concerned QR Code generation setting properties for adjust the image and encoding data:
Java QR Code Size Setting Aspects
The size of QR Code generated in Java can be influenced with version, height, unit, width these four aspects.

Version for Java QR Code generation

There are 40 versions for QR Code size setting starting with 0. Different versions stand for different numbers of modules in one QR Code.

barcode.setversion(qrCodeVersion.1); //default is 1

QR Code image width concerned parameters in Java

barcode.setX(2);// Width of barcode module (narrow bar), default is 1 pixel

barcode.setBarCodeWidth(112);// the width value of QR Code image, default is 0

barcode.setleftMargin(3);// the space between the left side and bars in QR Code by Java QR Code

barcode.setrightMargin(3);// the space between the right side and bars in QR Code by Java QR Code, default is 0

QR Code image height concerned parameters in Java

barcode.setX(2);// Width of barcode module (narrow bar), default is 1 pixel

barcode.setBarCodeHeight(90);// the height value of QR Code image, default is 0

barcode.settopMargin(3);// the space between the top side and bars, default is 0

barcode.setbottomMargin(3);// the space between the bottom side and bars, default is 0

Common related size setting for QR Code in Java

barcode.setUOM(IBarCode.UOM_PIXEL);// Unit of meature for all size related settings.

UOM_PIXEL (0); UOM_CM (1); UOM_INCH (2). Default is UOM_PIXEL

barcode.settextFont("Arial", Font.PLAIN, 11);// the text font style of the generated QR Code, default is new Font("Arial", Font.PLAIN, 11)

barcode.settextMargin(4);// the space between text and barcode, default is 0

barcode.setsutoResize(true);//adjust the size with your setting properties by setting it to be true, default is false

QR Code Size Setting in Java - Common situations

Draw QR Code image with a Minimum Module size and BarCodeWidth in Java

In java applications, QR Code image size can be changed with moduleSize and BarCodeWidth at the same time.
  • Set the minimum value of module size. For example, barcode.setmoduleSize(2);
  • Set the fixed value of BarCodeWidth. For example, barcode.setBarCodeWidth (180);
  • Set the autoResize to be false. For example,barcode.setautoReisize(false);
  • Adjust other option with your need
Note that, once setting a fixed module size, a minimum BarCodeWidth QR Code image is automatically created in Java. If your set BarCodeWidth is smaller than the minimum value, the generated QR Code image width will be the minimum barcode width value in java. If your set value of BarCodeWidth is larger than the minimum one, the QR Code image width will be the larger one.