jbars
Class BarcodeServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--jbars.BarcodeServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class BarcodeServlet
- extends javax.servlet.http.HttpServlet
Barcode generator servlet
A servlet that creates PNG image of a barcode
according to the parameters sent to a the servlet
Mandatory HTTP parameters:
- barcodeType
- barcodeValue
- barcodeType
Parameter Values:
- barcodeType: CODE128, CODE93 or INTERLEAVED2OF5
- barcodeValue: Any text if code128 or code93, any integer number if interleaved2of5
- sizeY: height in pixels of the image(default value: 50)
- rotation: angle to rotate the image: 0,90,180 or 270
- barColor:color of the bars: black,green, etc
- textColor:color of the text: black,green, etc
- showText: Show the text true/false
- transparent: Use transparent background true/false
- alignment: Text alignment: CENTER, LEFT or RIGHT
- fontName: anme of the font, for example Helvetica
- fontSize:Font size
- fontStyle: Font style: BOLD, ITALIC or PLAIN
A very basic form to post data to generate a barcode
<form method="POST" action="/JBars/BarcodeServlet">
Barcode Type
<input type="text" name="barcodeType" >
<br>
Text to encode:
<input type="text" name="barcodeValue" >
<br>
Size Y(in pixels):
<input type="text" name="sizeY" >
<br>
Rotation:
<input type="text" name="rotation" >
<br>
Bar Color:
<input type="text" name="barColor" >
<br>
showText:
<input type="text" name="showText" >
<br>
fontName:
<input type="text" name="fontName" >
<br>
fontSize:
<input type="text" name="fontSize" >
<br>
fontStyle:
<input type="text" name="fontStyle" >
<br>
transparent:
<input type="text" name="transparent" >
<br>
alignment:
<input type="text" name="alignment" >
<br>
<input type="submit" value="Generator Barcode">
- Author:
- Andres Ederra
- See Also:
- Serialized Form
Method Summary |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
HTTP GET handler
Fecha de creación: (10/03/2003 13:28:37) |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
HTTP POST handler
points to the HTTP GET handler
Fecha de creación: (10/03/2003 13:28:37) |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BarcodeServlet
public BarcodeServlet()
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
- HTTP GET handler
Fecha de creación: (10/03/2003 13:28:37)
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Parameters:
res
- javax.servlet.http.HttpServletResponse
doPost
protected void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
- HTTP POST handler
points to the HTTP GET handler
Fecha de creación: (10/03/2003 13:28:37)
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Parameters:
res
- javax.servlet.http.HttpServletResponse