.NET Core QR Generator Export to image

1 Answer 77 Views
QRCode
Danielle
Top achievements
Rank 1
Iron
Iron
Danielle asked on 12 Sep 2024, 03:32 PM
I am looking at a business need to add QR codes to PDF exports.  I see that there is an option to export as an image in the JQuery version of  the product exportImage - API Reference - Kendo UI QRCode - Kendo UI for jQuery (telerik.com) but we are using the .NET Core version.  I do not see anything in the documentation about how to export QR codes to an image.  

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivaylo
Telerik team
answered on 16 Sep 2024, 12:34 PM

Hello Danielle,

Thank you for the details provided.

Generally, when you define the HtmlHelepr (or TagHelper) QRCode component, you can obtain its reference when the page is loaded (within the $(document).ready() function) and call any of the available QRCode client-side methods.

Having this in mind, you can utilize the "imageExport()" method of the QRCode to achieve the same functionality:

@(Html.Kendo().QRCode()
        .Name("qrMail")
        .Value("Hey")
)

<script>
$(document).ready(function(){
        var qrCode = $("#qrMail").getKendoQRCode(); // get a reference to the defines QRCode component

        qrCode.exportImage().done(function(data) { // call its exportImage() method (for example, when a button is clicked)
          kendo.saveAs({
              dataURI: data,
              fileName: "QRCode.png"
          });
      });
})
</script>
Additionally, I have prepared a sample REPL where you can test this example:

If this does not meet your requirements, please provide further details, and we will be happy to assist you.

I hope you find this information helpful.

 

Greetings,
Ivaylo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Danielle
Top achievements
Rank 1
Iron
Iron
commented on 16 Sep 2024, 01:10 PM

Thank you Ivaylo!  This is exactly what I needed.  Appreciate the help.
Tags
QRCode
Asked by
Danielle
Top achievements
Rank 1
Iron
Iron
Answers by
Ivaylo
Telerik team
Share this question
or