Genera codice a barre Data Matrix usando Java

This short tutorial describes how to generate the barcode data matrix using Java. All the necessary details are provided, such as a list of steps to write the application, the reference to the required library, and a code example to develop a datamatrix generator in Java. Various customization options will be discussed to generate the data matrix code according to the requirements.

Steps for the Data Matrix code generator using Java

  1. Set the IDE to use Aspose.BarCode for Java to develop a data matrix generator.
  2. Import the required module from the library to generate a Data Matrix code.
  3. Instantiate the barcode generator with the desired text and encoding type.
  4. Set the encoding mode to automatic for the data matrix.
  5. To make the resulting code reliable, set the error correction level to ECC 200.
  6. Define the size of each module cell in the output barcode.
  7. Imposta la risoluzione dell’immagine al valore desiderato
  8. Save the generated Data Matrix barcode as an image to disk.

Questi passaggi spiegano il processo per creare un generatore di codice datamatrix usando Java. Inizia il processo creando un oggetto della classe BarcodeGenerator con il testo di esempio da codificare e il tipo di codifica DATA_MATRIX, e salva l’immagine come barcode. Facoltativamente, puoi personalizzare l’immagine di output accedendo ai parametri del barcode e impostare la modalità di codifica, il livello di correzione degli errori, la dimensione del modulo nel barcode e la risoluzione dell’immagine.

Code for the Data Matrix generator using Java

This code example helps develop a Data Matrix QR code generator in Java. Imposta il rapporto d’aspetto per controllare la proporzione altezza/larghezza di ogni cella del modulo, imposta l’angolo di rotazione per controllare l’orientamento e imposta la didascalia sopra o sotto il simbolo codificato per rendere il QR code leggibile. You can also add a border for a framed look and set the background color instead of relying on the default white.

This article guides you in creating a 2D barcode. To set the barcode checksum, refer to the article Set the barcode checksum using Java.

 Italiano