Skip to main content

Deutsche Post Leitcode

  • 2 minutes to read

Deutsche Post Leitcode is a one-dimensional, numeric-only barcode symbology used by Deutsche Post for automated mail sorting and routing. The symbology encodes a fixed-length, 14-digit identifier that contains routing information (including postal codes and delivery identifiers).

Deutsche Post Leitcode is based on the Interleaved 2 of 5 (ITF) symbology and includes a checksum to help detect data-entry and scanning errors.

Deutsche Post Leitcode Barcode, DevExpress Barcode Generation API for Java

Refer to the following page for additional information: https://de.wikipedia.org/wiki/Leitcode

Configure Deutsche Post Leitcode Settings

Use the DeutschePostLeitcodeOptions class to configure Deutsche Post Identcode barcode settings.

The following code snippet creates a Deutsche Post Leitcode 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 {

        DeutschePostLeitcodeOptions options = new DeutschePostLeitcodeOptions();
        options.setPadding(new Padding(10));
        options.setShowText(true);
        options.setWidth(600);
        options.setHeight(150);

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("deutsche-post-leitcode.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "55500012345678",
                            fileStream,
                            DXImageFormat.getPng());
        }
    }
}

Fluent API

Use the DeutschePostLeitcodeOptionsBuilder class to configure Deutsche Post Leitcode barcode settings with the Fluent API.

The following code snippet creates a Deutsche Post Leitcode 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 {

        DeutschePostLeitcodeOptions options = DeutschePostLeitcodeOptionsBuilder.create()
            .withPadding(new Padding(10))
            .withShowText(true)
            .withWidth(600)
            .withHeight(150)
            .build();

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("deutsche-post-leitcode.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "55500012345678",
                            fileStream,
                            DXImageFormat.getPng());
        }
    }
}
See Also