New to Telerik UI for ASP.NET MVC? Download free 30-day trial

PDF Export

The StockChart component provides a built-in PDF export functionality.

For a runnable example, refer to the demo on exporting the StockChart to PDF.

To enable the PDF export:

  1. Define the PDF export settings of the chart through the Pdf() configuration. You can specify the author, creator, date, name of the exported file, paper size, and more.

        @(Html.Kendo().StockChart<StockDataPoint>()
        .Name("stockChart")
        .Pdf(pdf => pdf
            .FileName("Dashboard.pdf")
            .Date(DateTime.Now)
            .PaperSize("A4")
            .Margin(m => m.Top(2).Bottom(1).Left(2).Right(2))
        )
        ... // Additional configuration.
        )
    
  2. Create an external button that will trigger the export and handle its click event. Within the event handler, get a reference to the StockChart and call the exportPDF() or saveAsPDF() client-side method.

        @(Html.Kendo().Button()
        .Name("exportBtn")
        .Content("Export to PDF")
        .Events(ev => ev.Click("onClick")))
    
        <script>
            function onClick() {
                $("#stockChart").getKendoStockChart().exportPDF();
            }
        </script>
    

See Also

In this article