Many methods, you can refer to the following scenarios, do not expand, the address is as follows:
Https://www.cnblogs.com/mingmingruyuedlut/p/6120671.html
What is described here is a project requirement, which is exported as a picture and displayed in the Web page, with the following code:
Using ThoughtWorks.QRCode.Codec;
public void ProcessRequest (HttpContext context)
{
Context. Response.ContentType = "Text/plain";
String OrderNo = context. request.params["OrderNo"];
Qrcodeencoder encoder = new Qrcodeencoder ();
Encoder. Qrcodeencodemode = Qrcodeencoder.encode_mode. byte;//encoding Method (Note: Byte can support Chinese, alpha_numeric scan out is the number)
Encoder. Qrcodescale = 6;//size (the larger the value, the higher the image pixel of the resulting QR code)
Encoder. Qrcodeversion = 0;//Version (note: setting to 0 is primarily to prevent an error when the encoded string is too long)
Encoder. Qrcodeerrorcorrect = qrcodeencoder.error_correction. m;//error validation, error correction (4 levels)
Encoder. Qrcodebackgroundcolor = Color.yellow;
Encoder. Qrcodeforegroundcolor = Color.green;
System.Drawing.Image _codeimage = encoder. Encode (OrderNo);
System.IO.MemoryStream _stream = new System.IO.MemoryStream ();
_codeimage.save (_stream, System.Drawing.Imaging.ImageFormat.Jpeg);
Context. Response.ContentType = "Image/tiff";
Context. Response.Clear ();
Context. Response.bufferoutput = true;
Context. Response.BinaryWrite (_stream.getbuffer ());
Context. Response.Flush ();
39 yards generating section, shielding
/*context. Response.ContentType = "Text/plain";
String OrderNo = context. request.params["OrderNo"];
Webapplication1.code39 _code39 = new Code39 ();
_code39.height = 60;
_code39.magnify = 0;
_code39.viewfont = new Font ("Arial", 12);
System.Drawing.Image _codeimage = _code39.getcodeimage (OrderNo, Code39.Code39Model.Code39Normal, true);
System.IO.MemoryStream _stream = new System.IO.MemoryStream ();
_codeimage.save (_stream, System.Drawing.Imaging.ImageFormat.Jpeg);
Context. Response.ContentType = "Image/tiff";
Context. Response.Clear ();
Context. Response.bufferoutput = true;
Context. Response.BinaryWrite (_stream.getbuffer ());
Context. Response.Flush (); */
}
This. Image1.imageurl = "/textbuilder.ashx?" orderno= "+ ti_no;
Attach this method of QRCode use
C # generates two-dimensional code (QR code) and barcodes (bar code) from third-party components