- codigo de barras
+ Responder ao Tópico
-
codigo de barras
alguem tem o barcode.class ai ?
-
codigo de barras
Alguém tem componente de código de barras para delphi aí????
Valew!
-
codigo de barras
Encontrei este código no GOOGLE
The following code is an example of our java class library being used as a custom servlet:
//*****************************************************************
//
// JAVA Servlet sample code for IDABarCode 2.1
//
// Copyright, IDAutomation.com, Inc. 2000. All rights reserved.
//
// <a href="http://www.IDAutomation.com/" target="_blank" target="_new">http://www.IDAutomation.com/</a>
//
// NOTICE:
// You may incorporate our Source Code in your application
// only if you own a valid Java Barcode Package License
// from IDAutomation.com, Inc. and the copyright notices
// are not removed from the source code.
//
// NOTE: "BarCode" is the class of the linear barcode class
// For other classes such as PDF417, replace all text of "BarCode"
// with "PDF417".
//
//*****************************************************************
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import IDABarCode.*;
import IDABarCode.encoder.*;
import java.awt.Graphics2D.*;
import java.awt.*;
/** This is the Servlet class that contains code to create a bar code in a JPEG file from the server. */
public class BarCodeServlet extends HttpServlet
{
/**
* Handle the HTTP POST method by sending an e-mail
*
*
*/
public void init() throws ServletException {
}
// MODIFY THIS FUNCTION TO CREATE THE BARCODE USING THE request PARAMETERS
private BarCode getChart (HttpServletRequest request) {
BarCode cb=new BarCode();
cb.code="12345678901";
cb.barType=cb.CODE128;
return cb;
}
// Handle a request
// 1. create barcode
// 2. draw barcode in a Buffered Image
// 3. encode image as JPEG and send it to the browser
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
ServletOutputStream outb;
response.setContentType("image/jpeg"- );
//out=response.getWriter();
outb=response.getOutputStream();
// avoid caching in browser
response.setHeader ("Pragma", "no-cache"- );
response.setHeader ("Cache-Control", "no-cache"- );
response.setDateHeader ("Expires",0);
try { // Create buffer
java.awt.image.BufferedImage BarImage=new java.awt.image.BufferedImage(500,500,java.awt.image.BufferedImage.TYPE_INT_RGB);
java.awt.Graphics2D BarGraphics=BarImage.createGraphics();
// get BarCode
BarCode cb=getChart(request);
cb.setSize(BarImage.getWidth(null),BarImage.getHeight(null));
cb.paint(BarGraphics);
// create JPEG image
com.sun.image.codec.jpeg.JPEGImageEncoder encoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(outb );
encoder.encode( BarImage );
} catch (Exception e) { e.printStackTrace();}
//outb.close();
}
public void doPost (HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
}
}
[ Esta mensagem foi editada por: Marcio68Almeida em 26-06-2003 11:20 ]