Closed KanekiQAQ closed 3 years ago
It seems to also have an issue on blazor server side, not just wasm, (running linux docker at least)
System.Drawing
is not available on Blazor. Here are the formats that work on Blazor: https://github.com/codebude/QRCoder/issues/201#issuecomment-604833309
You might want to use PngByteQRCode
in your case.
It seems to also have an issue on blazor server side, not just wasm, (running linux docker at least)
Thanks. I got it.
System.Drawing
is not available on Blazor. Here are the formats that work on Blazor: #201 (comment)You might want to use
PngByteQRCode
in your case.
Thanks. I'll try.
Here is one way to do it:
@using QRCoder;
<img src="data:image/png;base64,@Base64EncodedQrCode" />
@code {
public string Base64EncodedQrCode { get; set; } = string.Empty;
protected override void OnInitialized()
{
base.OnInitialized();
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
PngByteQRCode pngByteQRCode = new PngByteQRCode(qrCodeData);
Base64EncodedQrCode = Convert.ToBase64String(pngByteQRCode.GetGraphic(10));
}
}
Type of issue
[ ] Bug
[*] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement
Expected Behavior
I want to use QRCoder in blazor wasm page,but I have some trouble. When I execute 'qrcode.GetGraphic()', there's an exception.Like this:
This is my code:
I want to know how to solve this problem. Thanks.
Current Behavior
Possible Solution (optional)
Steps to Reproduce (for bugs)
Your Environment
Version used: 1.3.9 Environment (.NET 3.5, .NET 4.X, .NETCore, ...): .NET Standard 2.1