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:
-
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. )
<kendo-stockchart name="stockChart" date-field="Date"> <pdf file-name="Dashboard.pdf" date=DateTime.Now paper-size="A4"> <chart-pdf-margin top="2" bottom="1" left="2" right="2"/> </pdf> <!-- Additional configuration --> </kendo-stockchart>
-
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 theexportPDF()
orsaveAsPDF()
client-side method.@(Html.Kendo().Button() .Name("exportBtn") .Content("Export to PDF") .Events(ev => ev.Click("onClick"))) <script> function onClick() { $("#stockChart").getKendoStockChart().exportPDF(); } </script>
<kendo-button name="exportBtn" on-click="onClick"> Export to PDF </kendo-button> <script> function onClick() { $("#stockChart").getKendoStockChart().exportPDF(); } </script>