SVG Paper print

Develop and Deploy Cross-Browser Web Apps .
Post Reply
kevinotton
Posts: 39
Joined: Thu May 15, 2014 8:18 am
Location: Needham Market, Suffolk, UK

SVG Paper print

Post by kevinotton »

Can't get dataToURL working to print a SVGpaper. Any help please.

xui.Class('App', 'xui.Module',{
Instance:{
iniComponents : function(){
// [

Code: Select all

, append=function(child){children.push(child.get(0));};
            
            append(
                xui.create("xui.UI.SVGPaper")
                .setHost(host,"xui_ui_svgpaper10")
                .setLeft("11.666666666666666em")
                .setTop("7.5em")
                .setHeight("33.333333333333336em")
                .setCustomStyle({
                    "KEY":{
                        "border-top":"solid 1px #000000",
                        "border-right":"solid 1px #000000",
                        "border-bottom":"solid 1px #000000",
                        "border-left":"solid 1px #000000"
                    }
                })
            );
            
            host.xui_ui_svgpaper10.append(
                xui.create("xui.svg.circle")
                .setHost(host,"xui_svg_circle10")
                .setSvgTag("Shapes:Circle")
                .setAttr({
                    "r":20,
                    "stroke":"#004A7F",
                    "fill":"#ffffff",
                    "stroke-width":2,
                    "cx":50,
                    "cy":80
                })
                );
            
            host.xui_ui_svgpaper10.append(
                xui.create("xui.svg.rect")
                .setHost(host,"xui_svg_rect2")
                .setSvgTag("Shapes:Rect")
                .setAttr({
                    "width":101,
                    "height":101,
                    "stroke":"#004A7F",
                    "fill":"#ffffff",
                    "stroke-width":2,
                    "x":269,
                    "y":279
                })
                );
            
            append(
                xui.create("xui.UI.Button")
                .setHost(host,"xui_ui_button18")
                .setLeft("2.5em")
                .setTop("2.5em")
                .setCaption("Button")
                .onClick("_xui_ui_button18_onclick")
            );
            
            return children;
            // ]]Code created by CrossUI RAD Studio
        },

        _print_onclick:function(profile, e, src, value){
            var ns = this, uictrl = profile.boxing();
            
//            canvg(document.getElementById('myCanvas'), svg);
            
        },

        _xui_ui_button18_onclick:function(profile, e, src, value){
            var ns = this, uictrl = profile.boxing();
            
         var canvas = document.getElementById('xui.UI.SVGPaper:a:');      // Tried the 3 name options here with no luck.
         var dataURL = canvas.toDataURL();
         console.log(dataURL);
        }
    }
});

Post Reply