com.aspose.barcode

Enum QREncodeMode

  • java.lang.Object
    • java.lang.Enum<QREncodeMode>
      • com.aspose.barcode.QREncodeMode
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<QREncodeMode>


    public enum QREncodeMode
    extends java.lang.Enum<QREncodeMode>

    Encoding mode for QR barcodes. It is recomended to Use AUTO with CodeTextEncoding = Encoding.UTF8 for latin symbols or digits and UTF_8_BOM for unicode symbols.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      AUTO
      Encode codetext as is non-unicode charset.
      BYTES
      Encode codetext as plain bytes.
      ECI_ENCODING
      Encode codetext with value set in the ECI_ENCODING property.
      EXTENDED_CODETEXT
      UTF_16_BEBOM
      Encode codetext with UTF8 encoding with first ByteOfMark character.
      UTF_8_BOM
      Encode codetext with UTF8 encoding with first ByteOfMark character.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • AUTO

        public static final QREncodeMode AUTO

        Encode codetext as is non-unicode charset. If there is any unicode character, the codetext will be encoded with value which is set in CodeTextEncoding.

      • BYTES

        public static final QREncodeMode BYTES

        Encode codetext as plain bytes. If it detects any unicode character, the character will be encoded as two bytes, lower byte first.

      • UTF_8_BOM

        public static final QREncodeMode UTF_8_BOM

        Encode codetext with UTF8 encoding with first ByteOfMark character.

      • UTF_16_BEBOM

        public static final QREncodeMode UTF_16_BEBOM

        Encode codetext with UTF8 encoding with first ByteOfMark character. It can be problems with some barcode scaners.

      • ECI_ENCODING

        public static final QREncodeMode ECI_ENCODING

        Encode codetext with value set in the ECI_ENCODING property. It can be problems with some old (pre 2006) barcode scaners.


         Example how to use ECI encoding
         
         BarCodeBuilder builder = new BarCodeBuilder();
         builder.setEncodeType(EncodeTypes.QR);
         builder.setQREncodeMode(QREncodeMode.ECI_ENCODING);
         builder.setQREncodeType(QREncodeType.FORCE_QR);
         builder.setECIEncoding(ECIEncodings.UTF8);
         builder.setCodeText("12345TEXT");
         builder.setQRErrorLevel(QRErrorLevel.LEVEL_L);
         Bitmap lBmp = builder.generateBarCodeImage();
         
      • EXTENDED_CODETEXT

        public static final QREncodeMode EXTENDED_CODETEXT

        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 to removing managing characters.

        Encoding Principles:

        All symbols "\" must be doubled "\\" in the codetext.

        FNC1 in first position is set in codetext as as "<FNC1>"

        FNC1 in second position is set in codetext as as "<FNC1(value)>". The value must be single symbols (a-z, A-Z) or digits from 0 to 99.

        Group Separator for FNC1 modes is set as 0x1D character '\\u001D'

        If you need to insert "<FNC1>" string into barcode write it as "<\FNC1>"

        ECI identifiers are set as single slash and six digits identifier "\000026" - UTF8 ECI identifier

        TO disable current ECI mode and convert to default JIS8 mode zero mode ECI indetifier is set. "\000000"

        All unicode characters after ECI identifier are automatically encoded into correct character codeset.


          Example how to use FNC1 first position in Extended Mode
          
          //create codetext
          QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
          lTextBuilder.addFNC1FirstPosition();
          lTextBuilder.addPlainCodetext("000%89%%0");
          lTextBuilder.addFNC1GroupSeparator();
          lTextBuilder.addPlainCodetext("12345<FNC1>");
         

        //generate codetext string lCodetext = lTextBuilder.GetExtendedCodetext();

        //generate BarCodeBuilder builder = new BarCodeBuilder(); builder.setEncodeType(EncodeTypes.QR); builder.setQREncodeMode(QREncodeMode.EXTENDED_CODETEXT); builder.setCodeText(lCodetext); builder.setQRErrorLevel(QRErrorLevel.LEVEL_L); builder.setDisplay2DText("My TEXT"); Bitmap lBmp = builder.generateBarCodeImage();

        Example how to use FNC1 second position in Extended Mode
          //create codetext
          QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
         lTextBuilder.addFNC1SecondPosition("12");
         lTextBuilder.addPlainCodetext("TRUE3456");
         

        //generate codetext string lCodetext = lTextBuilder.getExtendedCodetext();

        //generate BarCodeBuilder builder = new BarCodeBuilder(); builder.setEncodeType(EncodeTypes.QR); builder.setQREncodeMode(QREncodeMode.EXTENDED_CODETEXT); builder.setCodeText(lCodetext); builder.setQRErrorLevel(QRErrorLevel.LEVEL_L); builder.setDisplay2DText("My TEXT"); Bitmap lBmp = builder.generateBarCodeImage();

        Example how to use multi ECI mode in Extended Mode
          //create codetext
          QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
         lTextBuilder.addECICodetext(ECIEncodings.Win1251, "Will");
         lTextBuilder.addECICodetext(ECIEncodings.UTF8, "Right");
         lTextBuilder.addECICodetext(ECIEncodings.UTF16BE, "Power");
         lTextBuilder.addPlainCodetext(@"t\e\\st");
         

        //generate codetext string lCodetext = lTextBuilder.getExtendedCodetext();

        //generate BarCodeBuilder builder = new BarCodeBuilder(); builder.setEncodeType(EncodeTypes.QR); builder.setQREncodeMode(QREncodeMode.EXTENDED_CODETEXT); builder.setCodeText(lCodetext); builder.setQRErrorLevel(QRErrorLevel.LEVEL_L); builder.setDisplay2DText("My TEXT"); Bitmap lBmp = builder.generateBarCodeImage();

    • Method Detail

      • values

        public static QREncodeMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (QREncodeMode c : QREncodeMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static QREncodeMode valueOf(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()