This is a migrated thread and some comments may be shown as answers.

Want to retrieve bar code in byte array form

3 Answers 151 Views
Barcode
This is a migrated thread and some comments may be shown as answers.
Mahesh
Top achievements
Rank 1
Mahesh asked on 19 Sep 2013, 12:11 PM
I want to retrieve bar code in byte array form, is this possible?
If not what other options could be?

Please reply ASAP.

Thanks,
Mahesh A

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Sep 2013, 01:16 PM
Hello Mahesh,

I am afraid that such byte array cannot be extracted from the Barcode widget.

I am sorry for any inconvenience caused.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mahesh
Top achievements
Rank 1
answered on 20 Sep 2013, 02:31 PM
Hello Petur,
    
      Thanks for your reply,
      I have written following code to create bar code.
      $("#barCodeTest").kendoBarcode({
            value: "012345",
            renderAs: "svg",
            type: "upce",
            width: 150,
            height: 60
        });
       
        var barCode = $("#barCodeTest").data("kendoBarcode");
        if (barCode != null) {
            // Getting Error here, following methods are not able to access
            var image = barCode.imageDataURL();
            var svg = barCode.svg();
        }

       I am not able access "imageDataURL()" and "svg()" methods.
       How to use these or which libraries need to include to access these methods?

      Is it possible to get image object from "imageDataURL()" or "svg()" methods?

     I have also attached sample application with this post. Please check it.

   Thanks,
   Mahesh A
0
Petur Subev
Telerik team
answered on 23 Sep 2013, 07:58 AM
Hello Mahesh,

You have included old versions and scripts that are already included in the all.min.js pack of kendo.

Try with the following scripts and you should make everything work:

<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.rtl.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
 
<script type="text/javascript">
 
    $(document).ready(function () {
        // For each barcode type value length is different
        $("#barCodeTest").kendoBarcode({
            value: "0123451",
            renderAs: "svg",
            type: "ean8",
            width: 150,
            height: 60
        });
 
        var barCode = $("#barCodeTest").data("kendoBarcode");
        if (barCode != null) {
            // Getting Error here, following methods are not able to access
            var image = barCode.imageDataURL();
            var svg = barCode.svg();
 
            console.log(image);
            console.log(svg);
        }
    });
</script>
<h1>Bar code</h1>
<div id="barCodeTest"></div>


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Barcode
Asked by
Mahesh
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Mahesh
Top achievements
Rank 1
Share this question
or