Exporting Drawings to Images

The Drawing library supports the export of drawings to bitmap images in a PNG file format.

    <button class="k-button k-primary" onclick="exportImg()">Export Image</button>
    <script>
        var draw = kendo.drawing;
        var geom = kendo.geometry;

        var rect = new geom.Rect([5, 5], [240, 240]);
        var path = draw.Path.fromRect(rect).stroke("red", 5);

        var root = new draw.Group();
        root.append(path);

        function exportImg(){
            draw.exportImage(root, { width: "250px", height: "250px" }).done(function(data) {
                kendo.saveAs({
                    dataURI: data,
                    fileName: "frame.png"
                });
            });
        }
    </script>

See Also

In this article
Not finding the help you need? Improve this article