|
No. 1 Barcode SDK Provider for Java/.NET Professionals
|
Java Barcode is a Java barcode generator which generates high quality 1D (linear) and 2D (matrix) barcodes in Java, Jasper Reports, iReport, and Eclipse BIRT projects.
Data Matrix code is a two-dimensional matrix barcode consisting of black and white "cells" or modules arranged in either a square or rectangular pattern. The information to be encoded can be text or raw data. Usual data size is from a few bytes up to 2 kilobytes. The length of the encoded data depends on the symbol dimension used. Error correction codes are added to increase symbol strength: even if they are partially damaged, they can still be read. A Data Matrix symbol can store up to 2,335 alphanumeric characters.
Java Data Matrix Generator supports:
| Category | Class Properties | Servlet Properties | Default | Comments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic | data | DATA | "" | value to encode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Data Matrix Special |
processTilde | PROCESS-TILDE | false |
Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dataMode | DATA-MODE | 0 |
Set the dataMode property.
Valid value is 0 DataMatrix.M_AUTO (default), 1 DataMatrix.M_ASCII, 2 DataMatrix.M_C40, 3 DataMatrix.M_TEXT, 4 DataMatrix.M_X12, 5 DataMatrix.M_EDIFACT, 6 DataMatrix.M_BASE256.
Servlet Parameter: "DataMode". |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| formatMode | FORMAT-MODE | 0 | Default is DataMatrix.F_10X10. Specifies the Data Matrix Format to use on that symbology. Valid values see class DataMatrix.F_*x*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fnc1Mode | FNC1MODE | IBarcode.FNC1_NONE (0) | valid values:
IBarcode.FNC1_NONE (0) IBarcode.FNC1_ENABLE (1) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| applicationIndicator | AI | 0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isStructuredAppend | STRUCTURE-APPEND | false | Set isStructuredAppend property to true, then Structured Append is enabled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| symbolCount | SYMBOL-COUNT | 0 | Set symbolCount property to the number of total symbols which make the sequence. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| symbolIndex | SYMBOL-INDEX | 0 | Set symbolIndex property to the position of current symbol in the secuence (Start with 0). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fileID | FILE-ID | 0 | Set fileID property to be identified to the same file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Size Related | uom | UOM | 0 | Unit of meature for all size related setting in the library.
0: pixel; 1: inch; 2: cm. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| X | X | 2 | width of barcode module (narrow bar), default is 2 pixel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| barcodeWidth | BARCODE-WIDTH | 0 | generted barcode image width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| barcodeHeight | BARCODE-HEIGHT | 0 | generted barcode image height | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| leftMargin | LEFT-MARGIN | 0 | image left margin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rightMargin | RIGHT-MARGIN | 0 | image right margin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| topMargin | TOP-MARGIN | 0 | image top margin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bottomMargin | BOTTOM-MARGIN | 0 | image bottom margin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resolution | RESOLUTION | 72 | in DPI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rotate | ROTATE | IBarcode.ROTATE_0 (0) | valid values:
IBarcode.ROTATE_0 (0), IBarcode.ROTATE_90 (1), IBarcode.ROTATE_180 (2), IBarcode.ROTATE_270 (3) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 DataMatrix barcode = new DataMatrix();
9 barcode.setData("0123456789");
10 barcode.drawBarcode("C://barcode-datamatrix.gif");
1 package com.onbarcode.barcode.test;
2
3 import com.onbarcode.barcode.AbstractBarcode;
4 import com.onbarcode.barcode.DataMatrix;
5
6 import javax.servlet.http.HttpServlet;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9 import javax.servlet.ServletException;
10 import javax.servlet.ServletOutputStream;
11
12 public class TestServlet extends HttpServlet
13 {
14 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
15 {
16 try {
17 DataMatrix barcode = new DataMatrix();
18 barcode.setData("0123456789");
19
20 ServletOutputStream servletoutputstream = response.getOutputStream();
21
22 response.setContentType("image/jpeg");
23 response.setHeader("Pragma", "no-cache");
24 response.setHeader("Cache-Control", "no-cache");
25 response.setDateHeader("Expires", 0);
26
27 barcode.drawBarcode(servletoutputstream);
28
29 } catch (Exception e) {
30 throw new ServletException(e);
31 }
32 }
33 }
34
8 DataMatrix barcode = new DataMatrix();
9 barcode.setData("0123456789");
10 barcode.drawBarcode("C://barcode-datamatrix.gif");
1) You can set barcode image width and height through properties barcodeWidth and barcodeHeight values.
or
2) You can set X (bar module width) and Y (bar module height) values