Generate and Read Royal Mail Mailmark 2D Barcodes in Java

Overview

Royal Mail has developed a special postal barcode standard called Mailmark to store postal and shipping data using the the DataMatrix symbology format. Mailmark 2D supports three subtypes, namely, 7, 9, and 29, that provides various capacities to encode customer information. When required, customer data can be added to main barcode text using specific fields. The available customer data capacity varies depending on the used Mailmark subtype and the barcode text encoding. additional customer data fields may be used to store information about printing and scanning procedures, item identifiers, or data required to perform barcode scanning through mobile devices.

To encode barcode data, the Mailmark 2D symbology applies the common C40 set of characters, including numerical digits, uppercase English letters, and space. All barcode data fields except customer information must have the format suitable for the specified encoding mode. In contrast, customer data does not need to support encoding compatibility. It should be noted that applying non-conventional encodings may require extra data capacity.

To process Mailmark 2D barcode images, Aspose.BarCode for Java provides class Mailmark2DCodetext.

Generate Mailmark 2D Barcodes

Developers can create Mailmark 2D barcodes in the following manner. First, it is necessary to generate an instance of class Mailmark2DCodetext entering information to be encoded. Then, the method generateBarCodeImage() of class ComplexBarcodeGenerator needs to be called to complete barcode generation. The Mailmark2DType enumeration is intended to determine the desired Mailmark 2D subtype ofor the generated barcode.

Following Mailmark 2D barcode images have been generated using various Mailmark 2D subtypes.

Mailmark 2D

Type 7

Type 9

Type 29

Read Mailmark 2D Barcodes

Using the Aspose.BarCode for Java functionality, developers can read Mailmark 2D barcodes of all types. First, it is necessary to generate an instance of class BarCodeReader setting it to DecodeType.DataMatrix. Thereafter, barcode data can be parsed using the tryDecodeMailmark2D(java.lang.String encodedCodetext) method of class ComplexCodetextReader that generates an instance of Mailmark2DCodetext containing decoded information.