|
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.
Code 39 (also known as "USS Code 39", "Code 3/9", "Code 3 of 9", "USD-3", "Alpha39", "Type 39") is a barcode symbology that can encode uppercase letters (A through Z), digits (0 through 9) and a handful of special characters like the $ sign.
Code 39 is restricted to 44 characters. In Full ASCII Code 39 Symbols 0-9, A-Z, "." ,and "-" are the same as their representations in Code 39. Lower case letters, additional punctuation characters and control characters are represented by sequences of two characters of Code 39.
Java Code 39 Generator supports:
Java Code 39 Extension Generator supports:
| Category | Class Properties | Servlet Properties | Default | Comments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic | data | DATA | "" | value to encode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| addCheckSum | ADD-CHECK-SUM | true | addCheckSum property is optional. Modulo 43 will be applied, if addCheckSum property is true. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Code 39 Special |
extension | EXTENSION | false | If you want to encode any 128 ASCII characters, extension must be true. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| I | I | 1.0 | The space between 2 characters in code 39; This a multiple of X; The default is 1.; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| N | N | 2.0 | Wide/narrow ratio, 2.0 - 3.0 inclusive, default is 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showStartStopInText | SHOW-START-STOP-IN-TEXT | true | If true, display a * in the beginning and end of barcode text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Size Related | uom | UOM | 0 | Unit of meature for all size related setting in the library.
0: pixel; 1: inch; 2: cm. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| X | X | 1 | width of barcode module (narrow bar), default is 1 pixel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Y | Y | 30 | barcode module height, default is 30 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) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text & Color |
showText | SHOW-TEXT | true | If true, display barcode data text, otherwise do not display. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showCheckSumChar | SHOW-CHECKSUM-CHAR | true | If true, display the check sum character in the end of data, if there is a check sum. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textFont | TEXT-FONT | Arial, Plain, 11 | Barcode text font style | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textMargin | TEXT-MARGIN | 6 | Space between barcode and barcode data text, default is 6 pixel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 Code39 barcode = new Code39();
9 barcode.setData("0123456789");
10 barcode.drawBarcode("C://barcode-code39.gif");
1 package com.onbarcode.barcode.test;
2
3 import com.onbarcode.barcode.AbstractBarcode;
4 import com.onbarcode.barcode.Code39;
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 Code39 barcode = new Code39();
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 Code39 barcode = new Code39();
9 barcode.setData("0123456789");
10 barcode.drawBarcode("C://barcode.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