Java Data Matrix Generator Image Setting Tutorial

sample source code to generate 2D Data Matrix in png, jpeg, etc. image formats in Java


  • High quality Data Matrix images may be printed with any printers, including those low resolution printers
  • Common-used image formats are valid here, which are png, tiff, gif, jpeg and bmp
  • Text margin, text font can influence the size of Data Matrix in Java for superb quality Data Matrix 2D barcode images
  • Data Matrix image height can be adjusted with X (bar width), barcodeWidth, leftMargin and rightMargin in Java
  • Java Client applications (Java Class, Swing, Applet, Java Bean and J2SE) are supported
  • Easy to generate Data Matrix images in Java Reports, such as Jasper Report, iReport, Eclipse BIRT and Oracle Reports
  • Detailed tutorial guide for Java Data Matrix generator is provided for your easier programming
  • Generate and print Data Matrix in JDK 1.4.0 and later version

Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.

Onbarcode provodes three 2D Java Barcode Generator which are QR Code generation library for Java, PDF 417 generation SDK in Java and Data Matrix generation component for Java.

Data Matrix Size Setting for Java focus on setting Data Matrix bar width, bar height, data mode, margins and so on;

Data Matrix Data Encoding for Java focus on encoding Data Matrix available data set and data length.



Java Data Matrix Image Setting Aspects

Java Data Matrix generation component consist of all Data Matrix generation details on all possible setting as below.

Java Data Matrix Special Setting Parameters

As a 2D barcode type for Java programming, Java Data Matrix generator is famous for its large compability with storing up to 2,335 alphanumeric characters. Some special parameters contribute to its popularity such as structureAppend, symbolCount, formatMode and so on.

  • structureAppend: To place or insert as an attachment by adding data to the end of a file or database or extending a character string with setting to be ture, default is false.
  • formatMode: Specifies the Data Matrix Format to use on that symbology, default is 0 (DataMatrix.F_10X10).
  • symbolCount: Make the sequence of of the number of the total symbols with setting it to be ture, default is false.

Java Data Matrix Common Used Image Parameters

  • resolution: Data Matrix barcode image resolution in DPI (Dots per inch), default is 72;
  • rotate: show the Data Matrix generated in Java with 0, 90, 180, 270 angles by rotating it, default is 0 (IBarcode.ROTATE_0); Valid choices are 0 (IBarcode.ROTATE_0); 1 (IBarcode.ROTATE_90); 2 (IBarcode.ROTATE_180); 3 (IBarcode.ROTATE_270);
  • backColor: Java Data Matrix image background color, default is white;
  • foreColor: Java Data Matrix fore ground color, which actually is the bar color, default is black;
  • barAlignment: Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right; default is 1: center.



Java Data Matrix Image Setting Implementation

      DataMatrix barcode = new DataMatrix();
barcode.setData("Data-Matrix-in-Java");

Java Data Matrix Common Used Image Setting Implementation

      barcode.setResolution(100);
barcode.setRotate(IBarcode.ROTATE_270);
barcode.setbackColor(red);
barcode.setforeColor(black);
barcode.setbarAlignment(1(center));

Java Data Matrix Special Image Setting Implementation

      barcode.setformatMode(0(DataMatrix.F_10X10));
barcode.setstructureApend(false);
barcode.setsysbolCunt(false);

Java Data Matrix Image Format Setting

Java Data Matrix generation control supports generating high quality Data Matrix image with common used image formats like png, tiff, gif, jpeg and bmp. A sample code is below for your easier implementation with just copying and changing to the target format.

      barcode.drawBarcode("C:\\Data Matrix.gif");




OnBarcode is a market-leading provider of barcode imaging generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.