I need to save the generated QRCode in Amazon S3 and I am using the OnAfterRenderAsync method for the same. I am however getting a error saying that QRCodeGenerator does not have any such method. Can you please advise? I am using the following for reference: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.BarcodeGenerator.SfQRCodeGenerator.html#Syncfusion_Blazor_BarcodeGenerator_SfQRCodeGenerator_OnAfterRenderAsync_System_Boolean_
Code to save generated BarCode in Amazon S3:
protected async Task QRCodeGenerator_OnAfterRenderAsync(bool firstRender)
{
}
Would you be able to advise me on how to do it via a simple code sample? The Export method generates the QR code and downloads it to the client browser.
As far as I looked, no event were exposed that were triggered when the qrcode was rendered successfully(please see my attempt above)
|
protected override Task OnAfterRenderAsync(bool firstRender)
{
return task;
} |
I dont understand, are you saying that SfQRCodeGenerator has an OnAfterRenderAsync event that we can handle, like below? This does not work, I get a compile error. Similarly, if I just handle the OnAfterRenderAsync event on the page, without saying that it is a , it will get triggered for every OnAfterRenderAsync event on the page.
<SfQRCodeGenerator Width="300px" Height="300px" Value="@UploadedS3FilePath" @ref="QRCodeGenerator" OnAfterRenderAsync="QRCodeGenerator_OnAfterRenderAsync">
<QRCodeGeneratorDisplayText text="@UploadedS3FilePath" Visibility="false"></QRCodeGeneratorDisplayText>
</SfQRCodeGenerator>
protected override async Task QRCodeGenerator_OnAfterRenderAsync(bool firstRender)
{
//Step 3: Save the barcode to S3.
}
Hello Aravind,Would you have any further updates
Hello Aravind,
I selected an document, uploaded to S3 and set the Value property of the SfQRCodeGenerator to the UploadedS3FilePath. In the
OnAfterRenderAsync method, I am trying to get the
uploadedBarCodeAsJPG_base64string but I never get the value. Please see
https://www.loom.com/share/b937ab5b4fc14358af6268343ce34e77 here.
What am I missing?
.razor.cs file:
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(firstRender == false && fileuploadedtoS3 == true && QRCodeGenerator!=null)
{
//Step 3: Save the barcode to S3.
var uploadedBarCodeAsJPG_base64string = QRCodeGenerator.ExportAsBase64Image(BarcodeExportType.JPG).Result;<= it never gets this value and move to the next line
var bytes1 = Convert.FromBase64String(uploadedBarCodeAsJPG_base64string);
//Code to save to Amazon S3
fileuploadedtoS3 =false;
}
}
.razor file:
@if(string.IsNullOrEmpty(UploadedS3FilePath)==false)
{
<SfQRCodeGenerator Width="300px" Height="300px" Value="@UploadedS3FilePath" @ref="QRCodeGenerator">
<QRCodeGeneratorDisplayText text="@UploadedS3FilePath" Visibility="false"></QRCodeGeneratorDisplayText>
</SfQRCodeGenerator>
}
This question can be closed. I should be able to use a different syncfusion nuget library to generate and save the QR code.
https://www.syncfusion.com/forums/125757/save-qr-barcode-to-file