Is there a way to export the diagram to a PNG/JPG file?
Thank you!
1 Answer, 1 is accepted
0
Accepted
Hristo Germanov
Telerik team
answered on 10 Jun 2014, 10:31 AM
Hi Jorge,
We haven't build in functionality and it is not supported officially. But I suggest you to download this code library and you can modify the view with the example code of the diagram basic usage for the test:
dataSource: new kendo.data.HierarchicalDataSource({
data: data,
schema: {
model: {
children: "items"
}
}
}),
layout: {
type: "layered"
},
shapeDefaults: {
visual: visualTemplate,
editable: false,
rotatable: false,
resizable: false
},
connectionDefaults: {
stroke: {
color: "#979797",
width: 2
}
}
});
var diagram = $("#diagram").getKendoDiagram();
diagram.bringIntoView(diagram.shapes);
}
$(document).ready(function () {
createDiagram();
$(".export").click(function () {
var diagram = $("#diagram").getKendoDiagram();
var svgString = escape(diagram.element.find(".k-canvas-container").html());
var exportFormat = $(this).data("format");
$("#exportString").val(svgString);
$("#exportFormat").val(exportFormat);
$("#exportForm").submit();
});
});
</script>
Note that the diagram widget hasn't svg method and you need to get the diagram's svg string manually. The second thing that you need to do is to update the scripts to the latest version of Kendo UI.
I hope that this can help you.
Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!