首页>代码>java通过Aspose.Word控件实现Word文档的操作>/AsposeWord/src/com/demo/TestQRcode.java
package com.demo;

import java.io.File; 
import java.util.Hashtable; 
   
import com.google.zxing.BarcodeFormat; 
import com.google.zxing.EncodeHintType; 
import com.google.zxing.MultiFormatWriter; 
import com.google.zxing.WriterException; 
import com.google.zxing.common.BitMatrix; 

public class TestQRcode {

	/**
	 * @param args
	 * @throws Exception 
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static void main(String[] args) throws Exception {
		String text = "<!DOCTYPE html>" +
				"<html>" +
				"<body>" +
				"<h1>我的第一段 JavaScript</h1>" +
//				"<script>" +
//				"alert('Not Numeric');" +
//				"</script>" +
				"</body>" +
				"</html>" 
				;
		int width = 300;
		int height = 300;
		// 二维码的图片格式
		String format = "gif";
		Hashtable hints = new Hashtable();
		// 内容所使用编码
		hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
		BitMatrix bitMatrix = new MultiFormatWriter().encode(text,BarcodeFormat.QR_CODE, width, height, hints);
		// 生成二维码
		File outputFile = new File("d:" + File.separator + "new.gif");
		MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile);

	}
	
	

}
最近下载更多
lmroman  LV8 4月2日
wusiyin  LV14 2022年9月1日
xueying049  LV5 2022年5月9日
x2b2d2  LV12 2021年8月4日
1439107348  LV1 2020年10月27日
慵懒的小橘猫  LV11 2020年5月21日
gxpcwm  LV22 2019年7月23日
1105570390  LV8 2019年7月22日
news_2019  LV2 2019年7月3日
123456fdfdsf  LV4 2019年5月20日
最近浏览更多
lmroman  LV8 4月2日
467277  LV13 3月26日
akittyboy  LV9 2月25日
neuwxr2015  LV8 2023年2月7日
1358849392  LV21 2022年11月11日
li_xiangquan 2022年11月9日
暂无贡献等级
wusiyin  LV14 2022年9月1日
魔幻男灵  LV8 2022年6月12日
xueying049  LV5 2022年5月9日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友