Want to retrieve bar code in byte array form

4 posts, 0 answers
  1. Mahesh
    Mahesh avatar
    5 posts
    Member since:
    Sep 2013

    Posted 19 Sep 2013 Link to this post

    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
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 20 Sep 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Mahesh
    Mahesh avatar
    5 posts
    Member since:
    Sep 2013

    Posted 20 Sep 2013 Link to this post

    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
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 23 Sep 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready