简体   繁体   English

使用ZXing的QRcode(错误校正问题)

[英]QRcode using ZXing (Issue with Error Correction)

Here is the code for ASP.net, this script run on a IIS (QR_Code.aspx) 这是ASP.net的代码,此脚本在IIS(QR_Code.aspx)上运行

OS: Windows 10 PRO 操作系统:Windows 10 PRO

<%@ Page language="vb" debug=true %>
<%@ Import NameSpace = "Zxing.Interop.Encoding.BarcodeWriter" %>
<%@ Import NameSpace = "System.IO" %>
<%@ Import NameSpace = "System.Drawing" %>

'-----------------------------------------------'
'QR-Code
'-----------------------------------------------'
Dim ZX As New ZXing.BarcodeWriter
Dim bmp As Bitmap

Zx.Format = ZXing.BarcodeFormat.QR_CODE
Zx.Options.Height = 250
Zx.Options.Width = 250
Zx.Options.Margin = 0.9
Zx.Options.PureBarcode = True
Zx.Format = 2048

bmp = Zx.Write("Test_1234")
bmp.Save("c:\inetpub\wwwroot\tester\qrcode.png", Imaging.ImageFormat.Png)
'-----------------------------------------------'

The above code is working just fine but my problem is that I'm unable to find any correct reference for the "Error correction" for the above code. 上面的代码可以正常工作,但是我的问题是我找不到上面代码的“错误更正”的任何正确参考。

I've tried the following code but no luck! 我试过下面的代码,但是没有运气!

Zx.Options.ErrorCorrection = ErrorCorrectionLevel_H

or 要么

Zx.ErrorCorrection = ErrorCorrectionLevel_H

or 要么

ErrorCorrection = ErrorCorrectionLevel_H

Keep getting this error message from the browser 不断从浏览器中收到此错误消息

Compiler Error Message: BC30456: 'ErrorCorrection' is not a member of 'ZXing.Common.EncodingOptions'.

For your information: 供你参考:

Filename: zxing.dll
File Description: Zxing.net for 3.5
File Version: 0.16.4.0
Sha256 Hash: e1ed37bb6d376a35a05169a6bad52c6d589eac3bc3d676fc4ed6336e84d59fea 

Thank your for your time to read this threat, please forgive me if i don't reply in correct format - I'm still new in here! 感谢您抽出宝贵的时间阅读此威胁,如果我没有以正确的格式答复,请原谅我-我仍然是新来的!

The following code snippet should work: 以下代码段应该工作:

<%@ Page language="vb" debug=true %>
<%@ Import NameSpace = "System.Drawing" %>
<%

'-----------------------------------------------'
'QR-Code
'-----------------------------------------------'
Dim ZX As New ZXing.BarcodeWriter
Dim bmp As Bitmap
Dim options as ZXing.QrCode.QrCodeEncodingOptions

options = New ZXing.QrCode.QrCodeEncodingOptions
options.ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H
options.Height = 250
options.Width = 250
options.Margin = 0.9
options.PureBarcode = True

Zx.Format = ZXing.BarcodeFormat.QR_CODE
Zx.Options = options

bmp = Zx.Write("Test_1234")
bmp.Save("c:\inetpub\wwwroot\tester\qrcode.png", Imaging.ImageFormat.Png)
'-----------------------------------------------'
%>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM