Skip to main content

QRCodeVersion Enum

Lists values that indicate the QR Code version (size).

Declaration

public enum QRCodeVersion extends Enum<QRCodeVersion> implements IIntEnum

Members

Name Description
AUTO_VERSION

The version is determined automatically.

VERSION_1

21x21

VERSION_10

57x57

VERSION_11

61x61

VERSION_12

65x65

VERSION_13

69x69

VERSION_14

73x73

VERSION_15

77x77

VERSION_16

81x81

VERSION_17

85x85

VERSION_18

89x89

VERSION_19

93x93

VERSION_2

25x25

VERSION_20

97x97

VERSION_21

101x101

VERSION_22

105x105

VERSION_23

109x109

VERSION_24

113x113

VERSION_25

117x117

VERSION_26

121x121

VERSION_27

125x125

VERSION_28

131x131

VERSION_29

137x137

VERSION_3

29x29

VERSION_30

143x143

VERSION_31

149x149

VERSION_32

155x155

VERSION_33

161x161

VERSION_34

167x167

VERSION_35

173x173

VERSION_36

179x179

VERSION_37

185x185

VERSION_38

191x191

VERSION_39

197x197

VERSION_4

33x33

VERSION_40

203x203

VERSION_5

37x37

VERSION_6

41x41

VERSION_7

45x45

VERSION_8

49x49

VERSION_9

53x53

fromValue(int value)

Returns the QRCodeVersion enumeration constant with the specified integer value.

getName()

Returns the name of the QRCodeVersion enumeration constant.

getValue()

Returns the integer value associated with the QRCodeVersion enumeration constant.

toString()

Returns the string representation of the QRCodeVersion enumeration constant.

valueOf(String name)

Returns the QRCodeVersion enumeration constant with the specified name.

values()

Returns an array of all QRCodeVersion enumeration constants.

Remarks

The following code snippet creates a QR Code barcode and customizes its encoding parameters:

import com.devexpress.drawing.*;
import com.devexpress.docs.barcode.*;
import com.devexpress.system.drawing.*;
import com.devexpress.docs.Padding;

import java.io.*;
import java.nio.file.*;

public class Main {
    public static void main(String[] args) throws Exception {

        byte[] logoBytes = Files.readAllBytes(Path.of("images/devexpress-logo.png"));

        try (DXImage logo = DXImage.fromStream(new ByteArrayInputStream(logoBytes))) {

            // Customize QR Code parameters.
            QRCodeOptions options = new QRCodeOptions();
            options.setErrorCorrectionLevel(QRCodeErrorCorrectionLevel.H);
            options.setCompactionMode(QRCodeCompactionMode.AUTO);
            options.setVersion(QRCodeVersion.VERSION_10);
            options.setIncludeQuietZone(true);
            options.setLogo(logo);
            options.setPadding(new Padding(10));
            options.setModuleSize(10);
            options.setShowText(false);

            // Customize QR Code frame parameters.
            RectangleQRFrameOptions frameOptions = new RectangleQRFrameOptions();
            frameOptions.setPadding(new Padding(10));
            frameOptions.setFrameColor(Color.getOrange());
            frameOptions.setFrameWidth(10);
            frameOptions.setText("DevExpress");
            frameOptions.setCornerRadius(10);
            frameOptions.setTextAlignment(QRFrameTextAlignment.CENTER);
            frameOptions.setTextColor(Color.getBlack());
            frameOptions.setTextPosition(QRFrameTextPosition.BOTTOM);

            options.setFrameOptions(frameOptions);

            Path outputDir = Path.of("output");
            Files.createDirectories(outputDir);

            try (FileOutputStream fileStream = new FileOutputStream(
                    outputDir.resolve("qrcode.png").toFile());
                    BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                        barcodeGenerator.export(
                                "https://www.devexpress.com",
                                fileStream,
                                DXImageFormat.getPng());
            }
        }
    }
}

Refer to the following help topic for additional information: QR Code.

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
java.lang.Enum
QRCodeVersion