New to Telerik UI for ASP.NET Core? Start a free 30-day trial
PDF Export
The Diagram provides a built-in PDF export functionality.
For a runnable example, refer to the demo on exporting the Diagram to PDF.
Getting Started
To enable PDF export in the Diagram:
- Introduce a button and handle its
click
event. Export the Diagram within the handler.
HTML
<button class='export-pdf k-button'>Save as PDF</button>
- Include the Pako Deflate library in the page to enable compression.
To enable PDF export in the Diagram through code, call the saveAsPdf
method.
Razor
<button class='export-pdf k-button'>Save as PDF</button>
@(Html.Kendo().Diagram()
.Name("diagram")
.Pdf(pdf => pdf
.FileName("Kendo UI Diagram Export.pdf")
.ProxyURL(Url.Action("Pdf_Export_Save", "Diagram"))
)
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Pdf_Export_Read", "Diagram")
)
.Model(m => m.Children("Items"))
)
.Editable(false)
.Layout(l => l.Type(DiagramLayoutType.Layered))
.ShapeDefaults(sd => sd
.Visual("visualTemplate")
)
.ConnectionDefaults(cd => cd
.Stroke(s => s
.Color("#979797")
.Width(2)
)
)
.Events(events => events.DataBound("onDataBound"))
)