BarcodeServlet and barcode.jsp Reference

Both barcode.jsp and BarcodeServlet represent a barcode image. You use them the same way you would a CGI program. They are only provided as a reference and for your convenience. If you are a Java programmer, you can modify their content anyway you see fit.

Syntax

<img src="http://path/BarcodeServlet">

<img src="http://path/barcode.jsp">

<img src="http://path/BarcodeServlet?
     image=imageFormat
     type=type
     data=data
     addondata=addOnData
     rotate=rotation
     height=height
     barwidth=barWidth
     caption=caption
     addoncaption=addOnCaption
     fontname=fontName
     fontsize=fontSize
     gui=true">

<img src="http://path/barcode.jsp?
     image=imageFormat
     type=type
     data=data
     addondata=addOnData
     rotate=rotation
     height=height
     barwidth=barWidth
     caption=caption
     addoncaption=addOnCaption
     fontname=fontName
     fontsize=fontSize
     gui=true">

Parameters

All the parameters are optional:

image

Numeric value indicating the image format:

type

Numeric value indicating the barcode type

data

String specifying the barcode data

addOnData

String specifying the barcode add-on data if the barcode has an add-on

rotation

Numeric value indicating the rotation of the barcode image. Note that gui=true is no longer necessary as of V3.1 of Barcode/JSP for rotation to take place.

height

Numeric value indicating the height of the barcode image in screen pixels

barWidth

Numeric value indicating the width of the thinnest barcode bar in screen pixels

caption

String specifying the barcode caption

addOnCaption

String specifying the barcode add-on caption

fontName

String specifying the name of the font to be used (Serif, SansSerif, Dialog or DialogInput). For this to be effective, you must also set gui=true currently, otherwise you'll always end up with SansSerif.

fontSize

Numeric (integer) specifying the point size of the font to be used

gui

Boolean indicating whether the barcode generation process should use GUI features (i.e., JDK AWT):

IMPORTANT: Using GUI features requires your web server run in graphics mode (e.g. X-Window) and also the barcode generation process will use more system resources. However, you won't have your choices of fonts unless gui=true is set.

Remarks

BarcodeServlet and barcode.jsp generate barcode images dynamically in the PNG or JPEG format.

They use only a subset of the properties provided by the component com.bokai.barcode.Barcode. If need be, you can modify their content to set other properties like text position, etc.