好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

使用Spire.Barcode程序库生成二维码的实例解析

我就给大家介绍下这个程序库,你可以在这里 下载 。

简介

程序库提供了名为scan的方法来读取 二维码 图像。这是一个重载方法,在这部分,我列出了它的定义方法。这些方法将在代码中测试这个程序库的表现。

publicstaticstring [] scan (bitmap bitmap);

在所有支持的二维码种类中扫描某个的图像:

  bitmap: 要扫描的图像

publicstaticstring[] scan(bitmap image, barcodetype barcodetype);

在特定的二维码中扫描某个图像:

bitmap: 要扫描的图像 barcodetype: 指定的二维码种类

publicstaticstring[] scan(bitmap bitmap, rectangle rect, barcodetype barcodetype);

在特定的二维码中扫描某个图像的指定一部分:

bitmap: 要扫描的图像 rect: 指定要扫描的位图的部分 barcodetype: 指定的二维码种类

简单代码

为了验证scan方法,我做了幅二维码图像命名为barcode.jpg.在这幅图中有很多元素:有三个qr code二维码,两个codabar 二维码和一个postnet 二维码。用不同的参数来扫描这些图形,我们应该会得到不同的结果。

下面是结果:

程序片段:

?

datas = barcodescanner.scan(bitmap);

结果:

程序片段:

?

datas = barcodescanner.scan(bitmap, barcodetype.codabar);

结果:

程序片段:

?

datas = barcodescanner.scan(bitmap, newrectangle(0, 0, bitmap.width, bitmap.height / 2),barcodetype.qrcode);

结果:

结论:

你可以自己试试看,我觉得这个程序库一定可以满足你。

原文链接:http://blog.csdn.net/eiceblue/article/details/43405173

dy("nrwz");

查看更多关于使用Spire.Barcode程序库生成二维码的实例解析的详细内容...

  阅读:54次