SVG Paper print

Develop and Deploy Cross-Browser Web Apps .

SVG Paper print

Postby kevinotton » Wed Aug 28, 2019 9:35 am

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

xui.Class('App', 'xui.Module',{
Instance:{
iniComponents : function(){
// [[Code created by CrossUI RAD Studio
var host=this, children=[], 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);
}
}
});
kevinotton
 
Posts: 39
Joined: Thu May 15, 2014 8:18 am
Location: Needham Market, Suffolk, UK

Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron