需在nuget 添加此dll
///content字符串
public static string GetQRCode(string content, int moduleSize = 9)
{
var encoder = new QrEncoder(ErrorCorrectionLevel.M);
QrCode qrCode = encoder.Encode(content);
GraphicsRenderer render = new GraphicsRenderer(new FixedModuleSize(moduleSize, QuietZoneModules.Two), Brushes.Black, Brushes.White);
MemoryStream memoryStream = new MemoryStream();
render.WriteToStream(qrCode.Matrix, ImageFormat.Jpeg, memoryStream);
byte[] arr = memoryStream.ToArray();
string base64Str = "data:image/jpeg;base64," + Convert.ToBase64String(arr);
return base64Str;
}