Question

I have a kendo chart with the remote data. Is it possible to export the chart to png or pdf format

Was it helpful?

Solution 2

It is possible if you use some third-party tool such as InkScape. The latter can convert SVG (the Kendo UI Chart native format) to pretty much anything else including PNG and PDF. You can use the svg method of the chart to get the underlying SVG and then send it to a remote service.

Here is an ASP.NET MVC application which shows how: https://github.com/telerik/kendo-examples-asp-net/tree/master/chart-inkscape-export

OTHER TIPS

Since Atanas Korchev's answer, kendo has implemented a built-in method to export a chart as a png, svg or a pdf file.

If you want to export a png file you can do it by using the exportImage function:

kendoChart.exportImage().done(function(data) {
    kendo.saveAs({
        dataURI: data,
        fileName: "chart.png"
    });
});

For a PDF, it's almost the same logic with the exportPDF function:

chart.exportPDF({ paperSize: "Auto", landscape: true }).done(function(data) {
    kendo.saveAs({
        dataURI: data,
        fileName: "chart.pdf"
    });
});

You may refer to kendo chart API documentation for more details about those functions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top