QR Code for Java
Barcode Java > Barcode in Java > 2D > QR Code

QR Code is a matrix code (or two-dimensional bar code) created by Japanese corporation Denso-Wave in 1994. The "QR" is derived from "Quick Response", as the creator intended the code to allow its contents to be decoded at high speed.

Java QR-Code prints:
  • numeric data (digits 0 - 9);
  • alphanumeric data (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : );
  • byte data (default: ISO/IEC 8859-1);
  • Kanji characters.
Java QR-Code Barcode Generator - Common Questions

1. How to generate QR-Code barcodes in JSP & HTML pages?

  1. Copy "barcoding" folder contents to your Java Servlet container like Tomcat or JBoss's applications folder
  2. Restart your Java Servlet container
  3. Open your web browser like IE, Firefox, and navigate to http://localhost:8080/barcoding/qrcode?DATA=0123456789
  4. To generate QRCode barcode images in JSP or HTML pages, insert the following html img tag code:
    <img src="http://localhost:8080/barcoding/qrcode?DATA=0123456789" border=0 />

2. How to create QR-Code barcodes in Java Servlet?

        try {
            QRCode barcode = new QRCode();
            barcode.setCode("Java QR Code Generation");

            response.setHeader("Pragma", "no-cache");
            response.setHeader("Cache-Control", "no-cache");
            response.setDateHeader("Expires", 0);
            ServletOutputStream servletoutputstream = response.getOutputStream();


        } catch (Exception e) {
            throw new ServletException(e);

3. How to generate QR-Code barcodes in Java Class?

        QRCode barcode = new QRCode();
        barcode.setCode("Create QR-Code in Java Class");

4. How to draw QR-Code barcodes to image files?

        QRCode barcode = new QRCode();
        barcode.setCode("Create & encode QRCode images in Java");

5. How to draw & print QR-Code barcodes to Java image objects or stream objects?

        QRCode barcode = new QRCode();
        barcode.setCode("How to draw & print QR-Code barcodes to Java image objects or stream objects?");
        barcode.drawOnGraphics("Graphics2D object");
        barcode.drawOnStream("OutputStream object");
Java Barcode QR-Code Generator - QR-Code Property Settings

  • code : QR-Code encoding data value.

    Servlet Parameter: data; Default Value: ""

  • dataMode : QR-Code encoding data mode.

    Servlet Parameter: data-mode; Default Value: 0 (MODE_AUTO)

  • processTilde

    Servlet Parameter: process-tilde; Default Value: false

  • fnc1Mode

    Servlet Parameter: fnc1-mode; Default Value: 0 (FNC1_NONE)

  • ecl : QR-Code error correction level.

    Servlet Parameter: ecl; Default Value: 0 (ECL_L)

  • eci : Valid values are from 000000 to 999999.

    Servlet Parameter: eci; Default Value: 3 (ECI_DEFAULT)

  • ai : Application Indicator

    Servlet Parameter: ai; Default Value: 0

  • version

    Servlet Parameter: version; Default Value: 1

Barcode Size

  • barcodeUnit : Unit of meature for all size related properties. 0: Pixel (default); 1: CM; 2: Inch.

    Servlet Parameter: barcode-unit; Default Value: 0 (UOM_PIXEL)

  • moduleSize : bar module width & height, default is 3 pixel

    Servlet Parameter: module-size; Default Value: 3.0f

  • leftMargin : generated barcode image left margin

    Servlet Parameter: left-margin; Default Value: 0.0f

  • rightMargin : generated barcode image right margin

    Servlet Parameter: right-margin; Default Value: 0.0f

  • topMargin : generated barcode image top margin

    Servlet Parameter: top-margin; Default Value: 0.0f

  • bottomMargin : generated barcode image bottom margin

    Servlet Parameter: bottom-margin; Default Value: 0.0f

  • resolution : generated data matrix image resolution in dpi

    Servlet Parameter: resolution; Default Value: 72 dpi

  • rotate : barcode data matrix rotate angle, valid values: 0 (ROTATE_0), 1 (ROTATE_90), 2 (ROTATE_180), 3 (ROTATE_270)

    Servlet Parameter: rotate; Default Value: 0 (ANGLE_0)

  • barcodeWidth

    Servlet Parameter: barcode-width; Default Value: 0

  • barcodeHeight

    Servlet Parameter: barcode-height; Default Value: 0

Multiple QR-Code

  • isStructuredAppend

    Servlet Parameter: structured-append; Default Value: false

  • symbolCount

    Servlet Parameter: symbol-count; Default Value: 0

  • symbolIndex

    Servlet Parameter: symbol-index; Default Value: 0

  • parity

    Servlet Parameter: parity; Default Value: 0

Java Barcode Generator Supporting Barcode Symbology Types

Quick Links