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);
}

相关文章:

  • 2022-12-23
  • 2021-06-24
  • 2021-11-23
  • 2021-11-03
  • 2021-11-21
  • 2021-11-29
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2022-01-24
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
相关资源
相似解决方案