public enum QREncodeMode extends java.lang.Enum<QREncodeMode>
{@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");| Enum Constant and Description |
|---|
AUTO
In Auto mode, the CodeText is encoded with maximum data compactness.
|
BINARY
In Binary mode, the CodeText is encoded with maximum data compactness.
|
BYTES
Deprecated.
This property is obsolete and will be removed in future releases. Instead, use the 'SetCodeText' method to convert the message to byte array with specified encoding.
|
ECI
In ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier.
|
ECI_ENCODING
Deprecated.
This property is obsolete and will be removed in future releases. Instead, use ECI option.
|
EXTENDED
Extended Channel mode which supports FNC1 first position, FNC1 second position and multi ECI modes.
|
EXTENDED_CODETEXT
Deprecated.
This property is obsolete and will be removed in future releases. Instead, use the 'Extended' encode mode.
|
UTF_16_BEBOM
Deprecated.
This property is obsolete and will be removed in future releases. Instead, use the 'SetCodeText' method with BigEndianUnicode encoding to add a byte order mark (BOM) and encode the message. After that, the CodeText can be encoded using the 'Auto' mode.
|
UTF_8_BOM
Deprecated.
This property is obsolete and will be removed in future releases. Instead, use the 'SetCodeText' method with UTF8 encoding to add a byte order mark (BOM) and encode the message. After that, the CodeText can be encoded using the 'Auto' mode.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getValue() |
static QREncodeMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static QREncodeMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final QREncodeMode AUTO
@Deprecated public static final QREncodeMode BYTES
@Deprecated public static final QREncodeMode UTF_8_BOM
@Deprecated public static final QREncodeMode UTF_16_BEBOM
@Deprecated public static final QREncodeMode ECI_ENCODING
public static final QREncodeMode EXTENDED_CODETEXT
public static final QREncodeMode EXTENDED
public static final QREncodeMode BINARY
public static final QREncodeMode ECI
public static QREncodeMode[] values()
for (QREncodeMode c : QREncodeMode.values()) System.out.println(c);
public static QREncodeMode valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic int getValue()