QRCode Barcode Property Settings





QRCode Property Settings


Barcode Java Class: com.onbarcode.barcode.QRCode.
Category Properties Value Comments
Basic Property: data
URL: DATA
Type: String
Default: ""
Barcode value to encode

QRCode Valid Data Char Set:
  • 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

 
QRCode
Special
Property: processTilde
URL: PROCESS-TILDE
Type: boolean
Default: true
Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused
  • for GS1 AI Code:
    ~ai2: AI with 2 digits
    ~ai3: AI with 3 digits
    ~ai4: AI with 4 digits
    ~ai5: AI with 5 digits
    ~ai6: AI with 6 digits
    ~ai7: AI with 7 digits
  • ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
  • SJIS: from ~9ddddd (Shift JIS 0x8140 ~ 0x9FFC and 0xE040 ~ 0xEBBF)
Property: dataMode
URL: DATA-MODE
Type: int
Default: 0 (QRCode.M_AUTO)
  • QRCode.M_AUTO (0): It allows encoding all 256 possible 8-bit byte values. This includes all ASCII characters value from 0 to 127 inclusive and provides for international character set support
  • QRCode.M_ALPHANUMERIC (1): It allows encoding alphanumeric data (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : ).
  • QRCode.M_BYTE (2): It allows encoding byte data (default: ISO/IEC 8859-1).
  • QRCode.M_NUMERIC (3): It allows encoding numeric data (digits 0 - 9).
  • QRCode.M_KANJI (4): It allows encoding Kanji characters.
Property: ECL
URL: ECL
Type: int
Default: QRCode.L (0)
QRCode Error Correction Level.
  • QRCode.ECL_L (0)
  • QRCode.ECL_M (1)
  • QRCode.ECL_Q (2)
  • QRCode.ECL_H (3)
Property: fnc1Mode
URL: FNC1MODE
Type: int

Default: IBarcode.
FNC1_NONE (0)
To encode GS1 compatible QR-Code barcide, you need set fnc1Mode value to IBarcode.FNC1_ENABLE (1).
Property: structuredAppend
URL: STRUCTURED-APPEND
Type: boolean
Default: false
Set StructuredAppend property to true, then Structured Append is enabled.
Property: symbolCount
URL: SYMBOL-COUNT
Type: int
Default: 0
the number of total symbols which make the sequence.
Property: symbolIndex
URL: SYMBOL-INDEX
Type: int
Default: 0
the position of current symbol in the secuence (Start with 0).
Property: parity
URL: PARITY
Type: int
Default: 0
-
Property: version
URL: VERSION
Type: int
Default: 1.
Valid values are from 1 to 40.
 
Barcode
Size
Related
Property: uom
URL: UOM
Type: int
Default: 0 (pixel)
Unit of meature for all size related settings in the library.
Valid values: 0: pixel; 1: inch; 2: cm.
Property: X
URL: X
Type: float
Default: 3.
Barcode bar module width and height, default is 3 pixel
Property: barcodeWidth
URL: BARCODE-WIDTH
Type: float
Default: 0.
Barcode image width.

If barcodeWidth setting is smaller than the barcode required minimum width, the library will automatically reset to barcode minimum width.
Property: barcodeHeight
URL: BARCODE-HEIGHT
Type: float
Default: 0.
Barcode image height.

If barcodeHeight setting is smaller than the barcode required minimum height, the library will automatically reset to barcode minimum height.
Property: leftMargin
URL: LEFT-MARGIN
Type: float
Default: 0.
Barcode image left margin size.
Property: rightMargin
URL: RIGHT-MARGIN
Type: float
Default: 0.
Barcode image right margin size.
Property: topMargin
URL: TOP-MARGIN
Type: float
Default: 0.
Barcode image top margin size.
Property: bottomMargin
URL: BOTTOM-MARGIN
Type: float
Default: 0.
Barcode image bottom margin size.
Property: resolution
URL: RESOLUTION
Type: int
Default: 72.
Barcode image resolution in DPI (Dots per inch).
Property: rotate
URL: ROTATE
Type: int
Default: 0 (IBarcode.ROTATE_0)
Valid values:

  • 0 (IBarcode.ROTATE_0)
  • 1 (IBarcode.ROTATE_90)
  • 2 (IBarcode.ROTATE_180)
  • 3 (IBarcode.ROTATE_270)
 
In WebStream query string, please use int value for Enums, "true" and "false" for bool.
 

QRCode Properties in the Java Program

Generating barcode QRCode in Java Class example

	QRCode barcode = new QRCode();
	
	/*
	   QRCode Valid data char set:
	        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
	*/
	barcode.setData("112233445566");
	barcode.setDataMode(QRCode.M_AUTO);
	barcode.setVersion(10);
	barcode.setEcl(QRCode.ECL_M);
	
	//  Set the processTilde property to true, if you want use the tilde character "~" 
	//  to specify special characters in the input data. Default is false.
	//
	//  1) 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
	//         Strings from "~256" to "~299" are unused
	//       modified to FS, GS, RS and US respectively.
	//  2) 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
	//         Strings from "~665536" to "~699999" are unused
	//  3) for GS1 AI Code: 
	//         ~ai2: AI with 2 digits
	//         ~ai3: AI with 3 digits
	//         ~ai4: AI with 4 digits
	//         ~ai5: AI with 5 digits
	//         ~ai6: AI with 6 digits
	//         ~ai7: AI with 7 digits
	//  4) ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
	//  5) SJIS: from ~9ddddd (Shift JIS 0x8140 ~ 0x9FFC and 0xE040 ~ 0xEBBF)
	barcode.setProcessTilde(false);
	
	// unit of measure for X, Y, LeftMargin, RightMargin, TopMargin, BottomMargin
	barcode.setUom(IBarcode.UOM_PIXEL);
	// barcode module width in pixel
	barcode.setX(3f);
	
	barcode.setLeftMargin(0f);
	barcode.setRightMargin(0f);
	barcode.setTopMargin(0f);
	barcode.setBottomMargin(0f);
	// barcode image resolution in dpi
	barcode.setResolution(72);
	
	/*
	  to save into gif file, file name end with .gif
	  to save into jpeg file, file name end with .jpg
	  to save into eps file, call method drawBarcode2EPS and file name end with .eps
	*/
	barcode.drawBarcode("C:\\qrcode.gif");



 

How to encode GS1 Compatible QR-Code?

  1. You need set property fnc1Mode value to IBarcode.FNC1_ENABLE (1), to indicate that the generated QR Code is GS1 compatible.


  2. You can use 2 methods to input GS1 AI elements

    1. Parenthesis: to use parenthesis to indicate an AI code. Eg. (01)12345


    2. Escape Tilde: to use ~ai* to indicate an AI while * is digit number of the AI (from 2 ~ 7). Eg. ~ai20112345 same as (01)12345

      Note:

      1. To use escape tilde, you need set processTilde property to true.

      2. You can not use parenthesis character in the data message, except, user enables ProcessTilde flag and use ~040 and ~041 to replace '(' and ')' Parenthesis must in pair, otherwise, the output would be incorrect.




Barcode Types