QrCodeEncodingOptions options = new QrCodeEncodingOptions();
options.CharacterSet = "UTF-8";
options.DisableECI = true; // Extended Channel Interpretation (ECI) 主要用于特殊的字符集。并不是所有的扫描器都支持这种编码。
options.ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H; // 纠错级别
options.Width = 300;
options.Height = 300;
options.Margin = 1;
// options.Hints,更多属性,也可以在这里添加。
BarcodeWriter writer = new BarcodeWriter();
writer.Format = BarcodeFormat.QR_CODE;
writer.Options = options;
Response.Clear();
using (Bitmap bmp = writer.Write("http://www.cftea.com")) // Write 具备生成、写入两个功能
{
MemoryStream ms = new MemoryStream();
{
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
Response.ContentType = "image/png";
Response.BinaryWrite(ms.ToArray());
}
}
Response.End();
QrCodeEncodingOptions options = new QrCodeEncodingOptions();
options.CharacterSet = "UTF-8";
options.Width = 300;
options.Height = 50;
options.Margin = 1;
options.PureBarcode = false; // 是否是纯码,如果为 false,则会在图片下方显示数字
BarcodeWriter writer = new BarcodeWriter();
writer.Format = BarcodeFormat.CODE_128;
writer.Options = options;
Response.Clear();
using (Bitmap bmp = writer.Write("12345678"))
{
MemoryStream ms = new MemoryStream();
{
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
Response.ContentType = "image/png";
Response.BinaryWrite(ms.ToArray());
}
}
Response.End();
BarcodeReader reader = new BarcodeReader();
reader.Options.CharacterSet = "UTF-8";
using (Bitmap bmp = new Bitmap("D:\\qr.png"))
{
Result result = reader.Decode(bmp);
Response.Write(result.Text);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有