QREncodeMode

Inheritance: java.lang.Object, java.lang.Enum

public enum QREncodeMode extends Enum<QREncodeMode>

Encoding mode for QR barcodes. These samples show how to encode and save QR barcode with extended data formats.

{@code
 //This sample shows how to use ECI encoding and save a BarCode image.
 
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR);
 generator.setCodeText("12345TEXT");
 generator.getParameters().getBarcode().getQR().setEncodeMode(QREncodeMode.ECI_ENCODING);
 generator.getParameters().getBarcode().getQR().setQrECIEncoding(ECIEncodings.UTF8);
 generator.save("test.png");
 
 //This sample shows how to use FNC1 first position in Extended Mode.
 Extended Channel mode which supports FNC1 first position, FNC1 second position and multi ECI modes.
 It is better to use QrExtCodetextBuilder for extended codetext generation.
 Use Display2DText property to set visible text by removing managing characters.
 Encoding Principles:
 All symbols "\" must be doubled "\\" in the codetext.
 FNC1 in first position is set in codetext as "<FNC1>".
 FNC1 in second position is set in codetext as "<FNC1(value)>". The value must be a single character from a-z or A-Z, or a two-digit number from 00 to 99.
 Group Separator for FNC1 modes is set as 0x1D character ''.
 If you need to insert "<FNC1>" string into barcode write it as "<\FNC1>".
 ECI identifiers are set as single slash and six digits identifier, for example "\000026" for UTF8 ECI identifier.
 The default ECI mode is ISO/IEC 8859-1 ECI identifier "\000003". It does not need to be encoded at the beginning of the codetext.
 To switch from another ECI mode to the default ECI mode, use "\000003".
 All unicode characters after ECI identifier are automatically encoded into correct character codeset.
 QR compaction mode selectors are set as single slash and mode name: "\auto", "\num", "\alnum", "\byte", "\kanji".
 "\auto" sets automatic compaction mode, "\num" sets Numeric mode, "\alnum" sets AlphaNumeric mode, "\byte" sets Bytes mode, and "\kanji" sets Kanji mode.
 The default compaction mode is "\auto".
 Compaction mode selectors define the encoding mode for the following data until the next compaction mode selector or ECI identifier is found.
 If the data cannot be encoded in the selected compaction mode, an ArgumentException is thrown.
 This mode is not supported by MicroQR barcodes.
 
 //create codetext
 QrExtCodetextBuilder textBuilder = new QrExtCodetextBuilder();
 textBuilder.addFNC1FirstPosition();
 textBuilder.addPlainCodetext("000%89%%0");
 textBuilder.addFNC1GroupSeparator();
 textBuilder.addPlainCodetext("12345<FNC1>");
 //generate barcode
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR);
 generator.setCodeText(textBuilder.GetExtendedCodetext();
 generator.getParameters().getBarcode().getQR().setEncodeMode(QREncodeMode.Extended);
 generator.getParameters().getBarcode().getCodeTextParameters().setTwoDDisplayText("My Text");
 generator.save("test.png");
 
 //This sample shows how to use FNC1 second position in Extended Mode.
 //create codetext
 QrExtCodetextBuilder textBuilder = new QrExtCodetextBuilder();
 textBuilder.addFNC1SecondPosition("12");
 textBuilder.addPlainCodetext("TRUE3456");
 //generate barcode
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR);
 generator.setCodeText(textBuilder.GetExtendedCodetext();
 generator.getParameters().getBarcode().getQR().setEncodeMode(QREncodeMode.Extended);
 generator.getParameters().getBarcode().getCodeTextParameters().setTwoDDisplayText("My Text");
 generator.save("test.png");
 
 //This sample shows how to use multi ECI mode in Extended Mode.
 //create codetext
 QrExtCodetextBuilder textBuilder = new QrExtCodetextBuilder();
 textBuilder.addECICodetext(ECIEncodings.Win1251, "Will");
 textBuilder.addECICodetext(ECIEncodings.UTF8, "Right");
 textBuilder.addECICodetext(ECIEncodings.UTF16BE, "Power");
 textBuilder.addPlainCodetext"t\e\\st");
 textBuilder.addAlphaNumericCodetext("ASPOSE2001");
 textBuilder.addNumericCodetext(@"20012026");
 //generate barcode
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR);
 generator.setCodeText(textBuilder.getExtendedCodetext();
 generator.getParameters().getBarcode().getQR().setEncodeMode(QREncodeMode.EXTENDED);
 generator.getParameters().getBarcode().getCodeTextParameters().setTwoDDisplayText("My Text";
 generator.save("test.png");

Fields

FieldDescription
AUTOIn Auto mode, the CodeText is encoded with maximum data compactness.
BINARYIn Binary mode, the CodeText is encoded with maximum data compactness.
ECIIn ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier.
EXTENDEDExtended Channel mode which supports FNC1 first position, FNC1 second position and multi ECI modes.

Methods

MethodDescription
valueOf(Class arg0, String arg1)
compareTo(E arg0)
equals(Object arg0)
fromValue(int value)
getClass()
getDeclaringClass()
getValue()
hashCode()
name()
notify()
notifyAll()
ordinal()
toString()
valueOf(String name)
values()
wait()
wait(long arg0)
wait(long arg0, int arg1)

AUTO

public static final QREncodeMode AUTO

In Auto mode, the CodeText is encoded with maximum data compactness. Unicode characters are encoded in kanji mode if possible, or they are re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier. If a character is found that is not supported by the selected ECI encoding, an exception is thrown.

BINARY

public static final QREncodeMode BINARY

In Binary mode, the CodeText is encoded with maximum data compactness. If a Unicode character is found, an exception is thrown.

ECI

public static final QREncodeMode ECI

In ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier. If a character is found that is not supported by the selected ECI encoding, an exception is thrown. Please note that some old (pre 2006) scanners may not support this mode. This mode is not supported by MicroQR barcodes.

EXTENDED

public static final QREncodeMode EXTENDED

Extended Channel mode which supports FNC1 first position, FNC1 second position and multi ECI modes. It is better to use QrExtCodetextBuilder for extended codetext generation. Use Display2DText property to set visible text by removing managing characters. Encoding Principles: All symbols “\” must be doubled “\\” in the codetext. FNC1 in first position is set in codetext as “”. FNC1 in second position is set in codetext as “<FNC1(value)>”. The value must be a single character from a-z or A-Z, or a two-digit number from 00 to 99. Group Separator for FNC1 modes is set as 0x1D character ‘’. If you need to insert “” string into barcode write it as “<\FNC1>”. ECI identifiers are set as single slash and six digits identifier, for example “\000026” for UTF8 ECI identifier. The default ECI mode is ISO/IEC 8859-1 ECI identifier “\000003”. It does not need to be encoded at the beginning of the codetext. To switch from another ECI mode to the default ECI mode, use “\000003”. All unicode characters after ECI identifier are automatically encoded into correct character codeset. QR compaction mode selectors are set as single slash and mode name: “\auto”, “\num”, “\alnum”, “\byte”, “\kanji”. “\auto” sets automatic compaction mode, “\num” sets Numeric mode, “\alnum” sets AlphaNumeric mode, “\byte” sets Bytes mode, and “\kanji” sets Kanji mode. The default compaction mode is “\auto”. Compaction mode selectors define the encoding mode for the following data until the next compaction mode selector or ECI identifier is found. If the data cannot be encoded in the selected compaction mode, an ArgumentException is thrown. This mode is not supported by MicroQR barcodes.

valueOf(Class arg0, String arg1)

public static T <T>valueOf(Class<T> arg0, String arg1)

Parameters:

ParameterTypeDescription
arg0java.lang.Class
arg1java.lang.String

Returns: T

compareTo(E arg0)

public final int compareTo(E arg0)

Parameters:

ParameterTypeDescription
arg0E

Returns: int

equals(Object arg0)

public final boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

fromValue(int value)

public static QREncodeMode fromValue(int value)

Parameters:

ParameterTypeDescription
valueint

Returns: QREncodeMode

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getDeclaringClass()

public final Class<E> getDeclaringClass()

Returns: java.lang.Class

getValue()

public int getValue()

Returns: int

hashCode()

public final int hashCode()

Returns: int

name()

public final String name()

Returns: java.lang.String

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

ordinal()

public final int ordinal()

Returns: int

toString()

public String toString()

Returns: java.lang.String

valueOf(String name)

public static QREncodeMode valueOf(String name)

Parameters:

ParameterTypeDescription
namejava.lang.String

Returns: QREncodeMode

values()

public static QREncodeMode[] values()

Returns: com.aspose.barcode.generation.QREncodeMode[]

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int