qrcode.jar maven有么

Qrcode.jar 有么_百度知道
Qrcode.jar 有么
可靠性高。  QR Code码是由日本Denso公司于1994年9月研制的一种矩阵二维码符号,它具有一维条码及其它二维条码所具有的信息容量大、可表示汉字及图象多种文字信息、保密防伪性强等优点  有的,百度一下都有下载
其他类似问题
为您推荐:
qrcode的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁QRCode.jar和google的zxing.jar有什么区别_百度知道
QRCode.jar和google的zxing.jar有什么区别
这只是jar包的名字不同而已 要看里面有哪些类组成才知道啊 QRCode.jar 你也可以改成code.jar
知道智能回答机器人
根据知道用户的观点和内容总结出特定问题的答案,为知道用户提供更好的问答体验。
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁使用zxing生成QRCode二维码,在Android的webview中调用条形码扫描
zxing是一个条形码和二维码生成及识别的java开源组件,QRcode的中文名字是:QR快速响应矩阵码。
1.下载zxing最新的包
到zxing的主页:
其中BarcodeScanner3.5.2.apk是安装在Android操作系统的手机上的条码扫描器安装包。
条码扫描器的j2me版本下载地址为:
D:\Java\-1.6
在dos窗口下进入到:D:\Java\zxing-1.6\core,然后运行ant命令进行编译
(必须先安装配置了ant。
ant最新版的下载地址为:
下载解压后在系统的环境变量中配置ANT_HOME:例如:ANT_HOME=D:\Java\apache-ant-1.7.0;
Path中必须有ant的bin目录,例如:
Path=D:\Java\jdk1.6.0_21\D:\Java\apache-maven-2.0.9\D:\Perl\site\D:\
Perl\D:\Java\apache-ant-1.7.0\C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\
System32\WD:\Programs\svn-win32-1.5.4\C:\Program Files\TortoiseSVN\C
:\Program Files\QuickTime\QTSystem\
编译结果如下:
D:\Java\zxing-1.6\core>ant
Buildfile: build.xml
[mkdir] Created dir: D:\Java\zxing-1.6\core\build
[javac] Compiling 171 source files to D:\Java\zxing-1.6\core\build
[jar] Building jar: D:\Java\zxing-1.6\core\core.jar
BUILD SUCCESSFUL
Total time: 6 seconds
编译之后得到core.jar这个包。
再进入D:\Java\zxing-1.6\javase目录使用ant进行编译,编译结果如下:
D:\Java\zxing-1.6\javase>ant
Buildfile: build.xml
[mkdir] Created dir: D:\Java\zxing-1.6\javase\build
[javac] Compiling 6 source files to D:\Java\zxing-1.6\javase\build
[jar] Building jar: D:\Java\zxing-1.6\javase\javase.jar
BUILD SUCCESSFUL
Total time: 1 second
编译之后得到javase.jar这个包。
在Eclipse里新建Java工程:
编写java代码如下:
package com.lizongbo.;
import java.awt.image.BufferedI
import java.io.BufferedR
import java.io.F
import java.io.FileInputS
import java.io.IOE
import java.io.InputStreamR
import java.util.H
import javax.imageio.ImageIO;
import com.google.zxing.BarcodeF
import com.google.zxing.EncodeHintT
import com.google.zxing.MultiFormatW
import com.google.zxing.WriterE
import com.google.zxing.client.j2se.MatrixToImageW
import com.mon.BitM
public class QRCodeGen {
private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF;
* @param args
* @throws WriterException
* @throws IOException
public static void main(String[] args) throws WriterException, IOException {
String picFormat = “png”;
StringBuilder sb = new StringBuilder(1024);
java.io.InputStreamReader fr = new InputStreamReader(
new FileInputStream(“d:\\quickli.vcf”), “GBK”);
BufferedReader br = new BufferedReader(fr);
String line =
while ((line = br.readLine()) != null) {
sb.append(line).append(“\r\n”);
String str = sb.toString();// 二维码内容
System.out.println(str.length() + “|str==” + str);
str = new String(str.getBytes(“GBK”), “ISO-21;);
String path = “d:/lzb”;
Hashtable hints = new Hashtable();
// hints.put(EncodeHintType.CHARACTER_SET, “GBK”);
BitMatrix bitMatrix = new MultiFormatWriter().encode(str,
BarcodeFormat.QR_CODE, 400, 400, hints);
* begin 这段代码等同于就是 MatrixToImageWriter.writeToFile(bitMatrix, picFormat,
* 直接这样写就不用引用javase.jar
int width = bitMatrix.getWidth();
int height = bitMatrix.getHeight();
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
for (int x = 0; x < x++) {
for (int y = 0; y < y++) {
image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE);
File file = new File(path + &#8220;.&#8221; + picFormat);
ImageIO.write(image, picFormat, file);
* end 这段代码等同于就是 MatrixToImageWriter.writeToFile(bitMatrix, picFormat,
MatrixToImageWriter.writeToFile(bitMatrix, picFormat, file);
网址的QRcode生成如果不想编写代码,可以使用现成的google的api:
|1&#038;choe=UTF-8
Vcard也可以生成QRcode:
在线对二维码进行解码的url:
在Webview中通过js也可以调用条形码扫描,
封装的java代码如下:
final class BarCodeUtilHandler {
public void tryGetBarCode() {
Intent intent = new Intent(&#8220;com.google.zxing.client..SCAN&#8221;);
// intent.putExtra(&#8220;SCAN_MODE&#8221;, &#8220;QR_CODE_MODE&#8221;);
startActivityForResult(intent, 0);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Log.v(TAG, &#8220;onActivityResult===&#8221; + requestCode + &#8220;,&#8221; + resultCode + &#8220;,&#8221;
+ intent);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra(&#8220;SCAN_RESULT&#8221;);
String format = intent.getStringExtra(&#8220;SCAN_RESULT_FORMAT&#8221;);
webview.loadUrl(&#8220;javascript:showBarCode(\'&#8221; + format + &#8220;|&#8221;
+ contents + &#8220;\&#8217;)&#8221;);
} else if (resultCode == RESULT_CANCELED) {
webview.loadUrl(&#8220;javascript:showBarCode(\&#8217;没有找到条码!\&#8217;)&#8221;);
//webview.addJavascriptInterface(new BarCodeUtilHandler(), &#8220;barcodeutil&#8221;);
//javascript调用:window.barcodeutil.tryGetBarCode();
//function showBarCode(str) {
document.getElementById(&#8216;data&#8217;).value=
// } catch (ee) {
Tags: , , , ,
2010年十一月
8910111213
1516181920
222425262728
我曾经的blog
Powered by生成和解析二维码(QRCode.jar)
首先介绍什么是 QR 码?QR 码 是二维条码的一种,QR 来自英文 “Quick Response” 的缩写,即快速反应的意思,源自发明者希望 QR 码可让其内容快速被解码。QR码比普通条码可储存更多资料,亦无需像普通条码般在扫描时需直线对准扫描器。QR 码呈正方形,只有黑白两色。在4个角落的其中3个,印有较小,像“回”字的的正方图案。这 3 个是帮助解码软件定位的图案,使用者不需要对准,无论以任何角度扫描,资料仍可正确被读取。事例:错误修正容量L水平7% 的字码可被修正M水平15% 的字码可被修正Q水平25% 的字码可被修正H水平30% 的字码可被修正QR码资料容量数字最多 7,089 字符字母最多 4,296 字符二进制数&(8 bit)最多 2,953&位元日文汉字&/&片假名最多 1,817 字符 (采用Shift_JIS)中文汉字最多 984 字符 (采用UTF-8)中文汉字最多 1,800 字符 (采用BIG5)二维条码/二维码的特点1.高密度编码,信息容量大:可容纳多达1850个大写字母或2710个数字或1108个字节,或500多个汉字,比普通条码信息容量约高几十倍。2.编码范围广:该条码可以把图片、声音、文字、签字、指纹等可以数字化的信息进行编码,用条码表示出来;可表示图像数据。3.容错能力强,具有纠错功能:这使得二维条码因穿孔、污损等引起局部损坏时,照样可以正确得到识读,损毁面积达50%仍可恢复信息。4.译码可靠性高:它比普通条码译码错误率百万分之二要低得多,误码率不超过千万分之一。5.可引入加密措施:保密性、防伪性好。6.成本低,易制作,持久耐用。7.条码符号形状、尺寸大小比例可变。8.二维条码可以使用激光或CCD阅读器识读。实现方式:1.Java(参照http://blog.csdn.net/he90227/article/details/)非常详细,还是Maven版的。下载:http://download.csdn.net/detail/he32.JavaScript参照&html&&span style=&white-space:pre&& &/span&&head&&span style=&white-space:pre&& &/span&&title&二维码Test&/title&&span style=&white-space:pre&& &/span&&meta http-equiv=&Content-Type& content=&text/ charset=utf-8& /&&span style=&white-space:pre&& &/span&&meta name=&keywords& content=&JS生成二维码& /&&span style=&white-space:pre&& &/span&&!--此处需要引入三个JS文件&span style=&white-space:pre&& &/span& &#160;一、jquery.js&span style=&white-space:pre&& &/span& &#160;二、qrcode.js&span style=&white-space:pre&& &/span& &#160;三、jquery.qrcode.js&span style=&white-space:pre&& &/span&--&&span style=&white-space:pre&& &/span&&script src=&js/jquery-1.8.0.js& type=&text/javascript&&&/script&&span style=&white-space:pre&& &/span&&script src=&js/qrcode.js& type=&text/javascript&&&/script&&span style=&white-space:pre&& &/span&&script src=&js/jquery.qrcode.js& charset=&utf-8& type=&text/javascript&&&/script&&span style=&white-space:pre&& &/span&&script type=&text/javascript&&&span style=&white-space:pre&&
&/span&$(function() {&span style=&white-space:pre&&
&/span&$(&#bt&).bind(&click&, function() {&span style=&white-space:pre&&
&/span&var text = $(&#text&).val();&span style=&white-space:pre&&
&/span&//添加了logo图片路径&span style=&white-space:pre&&
&/span&$(&#39;#div_div&#39;).qrcode({&span style=&white-space:pre&&
&/span&text : utf16to8(text),&span style=&white-space:pre&&
&/span&height : 100,&span style=&white-space:pre&&
&/span&width : 100,&span style=&white-space:pre&&
&/span&//此处添加了个logo,可以随意替换链接&span style=&white-space:pre&&
&/span&src : &#39;file:///C:/Test.jpg&#39;&span style=&white-space:pre&&
&/span&});&span style=&white-space:pre&&
&/span&})&span style=&white-space:pre&&
&/span&})&span style=&white-space:pre&&
&/span&function utf16to8(str) {&#160;&span style=&white-space:pre&&
&/span&//转码&span style=&white-space:pre&&
&/span&var out, i, len,&span style=&white-space:pre&&
&/span&out = &&;&span style=&white-space:pre&&
&/span&len = str.&span style=&white-space:pre&&
&/span&for (i = 0; i & i++) {&span style=&white-space:pre&&
&/span&c = str.charCodeAt(i);&span style=&white-space:pre&&
&/span&if ((c &= 0x0001) && (c &= 0x007F)) {&span style=&white-space:pre&&
&/span&out += str.charAt(i);&span style=&white-space:pre&&
&/span&} else if (c & 0x07FF) {&span style=&white-space:pre&&
&/span&out += String.fromCharCode(0xE0 | ((c && 12) & 0x0F));&span style=&white-space:pre&&
&/span&out += String.fromCharCode(0x80 | ((c && 6) & 0x3F));&span style=&white-space:pre&&
&/span&out += String.fromCharCode(0x80 | ((c && 0) & 0x3F));&span style=&white-space:pre&&
&/span&} else {&span style=&white-space:pre&&
&/span&out += String.fromCharCode(0xC0 | ((c && 6) & 0x1F));&span style=&white-space:pre&&
&/span&out += String.fromCharCode(0x80 | ((c && 0) & 0x3F));&span style=&white-space:pre&&
&/span&}&span style=&white-space:pre&&
&/span&}&span style=&white-space:pre&&
&/span&&span style=&white-space:pre&&
&/span&}&span style=&white-space:pre&& &/span&&/script&&span style=&white-space:pre&& &/span&&/head&&span style=&white-space:pre&& &/span&&body&&span style=&white-space:pre&&
&/span&&input type=&text& id=&text& /&&span style=&white-space:pre&&
&/span&&input type=&button& value=&生成二维码& id=&bt& /&&span style=&white-space:pre&&
&/span&&div id=&div_div&&&span style=&white-space:pre&&
&/span&&div id=&qr_container& style=&margin: position:&&&/div&&span style=&white-space:pre&&
&/span&&/div&&span style=&white-space:pre&&
&/span&&!-- 用来校验该浏览器是否支持HTML5 --&&span style=&white-space:pre&&
&/span&&canvas id=&Canvas&&&/canvas&&span style=&white-space:pre&& &/span&&/body&
最新教程周点击榜
微信扫一扫}

我要回帖

更多关于 qrcode.jar 官网 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信