|
No. 1 Bar Code SDK Provider for Java/.NET/Objective-C 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.
The GS1 DataBar (formerly RSS) family consists of the following versions:
8 Code39 barcode = new Code39();
9 barcode.setData("0123456789");
10 barcode.drawBarcode("C://barcode.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