Skip to main content

Code39Options Class

Contains options specific to Code39 symbology.

Declaration

public class Code39Options extends BarcodeOptions

Remarks

Refer to the following help topic for additional information: Code 39 (USD-3).

The following code snippet creates a Code 39 (USD-3) barcode and customizes its encoding parameters with the Fluent API:

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 {

        Code39Options options = Code39OptionsBuilder.create()
            .withShowText(true)
            .withPadding(new Padding(10))
            .withWideNarrowRatio(3.0f)
            .withCalculateChecksum(true)
            .withWidth(600)
            .withHeight(150)
            .build();

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("code39.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "CODE-39-TEST",
                            fileStream,
                            DXImageFormat.getPng());
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
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
JavaObject
BarcodeOptions
Code39Options

Code39Options()

Initializes a new instance of the Code39Options class.

Declaration

public Code39Options()

Methods

getCalculateChecksum() Method

Gets whether to calculate and add a check character to barcode data.

Declaration

public boolean getCalculateChecksum()

Returns

Type Description
boolean

true to calculate and add a check character; otherwise, false.

getWideNarrowRatio() Method

Gets the wide bar to a narrow bar ratio.

Declaration

public float getWideNarrowRatio()

Returns

Type Description
float

Bar density.

setCalculateChecksum(boolean value) Method

Specifies whether to calculate and append a Modulo-43 check character.

Declaration

public void setCalculateChecksum(boolean value)

Parameters

Name Type Description
value boolean

true to calculate and append a Modulo-43 check character; otherwise, false.

setWideNarrowRatio(float value) Method

Specifies the ratio between wide and narrow bars and spaces in the barcode.

Declaration

public void setWideNarrowRatio(float value)

Parameters

Name Type Description
value float

Bar density.