java中的条形码阅读器 [英] barcode reader in java

查看:71
本文介绍了java中的条形码阅读器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public 
class imagetotext1 {

    public static void main(String[] args) throws Exception
        {
            BarcodeEAN codeEAN = new BarcodeEAN();
            codeEAN.setCodeType(Barcode.EAN8);
            codeEAN.setCode("4902555131719");
            Image image = codeEAN.createAwtImage(Color.black, Color.white);
            BufferedImage.TYPE_3BYTE_BGR);
            BufferedImage bffImg1=ImageIO.read(new File("D:\\testing\\p99.png"));
            Graphics offg = bffImg1.createGraphics();
            offg.drawImage(image,0,170, null);
            ImageIO.write(bffImg1, "jpeg", new File("test.jpg"));
        }
}





以上代码我可以创建条形码。

我该怎么做才能读取条形码?



in above code i can create bar code .
what can i do for reading bar code??

推荐答案

这一切都取决于您从中获取代码的库:



以下是来自Maven:



http://grepcode.com/file/repo1.maven.org/maven2/com.lowagie/itext/2.0。 1 / com / lowagie / text / pdf / BarcodeEAN.java



与上面的代码类似,它有setCode()API(参见左框架窗口并点击它)允许您输入要转换为图像的数字。



它还有getCode(),它允许你反之亦然。



查看您的库API以获取详细信息。
It all depends on the library where you get your code from:

Here below is from Maven:

http://grepcode.com/file/repo1.maven.org/maven2/com.lowagie/itext/2.0.1/com/lowagie/text/pdf/BarcodeEAN.java

Similar to your code above, it has "setCode()" API (see the left frame windows and click on it) to allow you to input the numbers to be converted to images.

And it also has "getCode()" which allow you to do vice versa.

Look up your library API for details.


这篇关于java中的条形码阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆