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();

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.


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.


Change the Width of QR Code with Java

//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


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

OnBarcode is a market-leading provider of barcode imaging generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © . All rights reserved.