Hello I have some trouble with a grid, when i try to add a Template in order to generate a personalizated Pdf file.
I wrote many times the example is shown by Telerik, but I only get a grid without the template.
I can“t see the pagination #pages nr etc.
My code is:
<style>
/*
Use the DejaVu Sans font for display and embedding in the PDF file.
The standard PDF fonts have no support for Unicode characters.
*/
.k-grid {
font-family: "DejaVu Sans", "Arial", sans-serif;
width: 750px;
height: 350px;
}
/* Hide the Grid header and pager during export */
.k-pdf-export .k-grid-toolbar,
.k-pdf-export .k-pager-wrap {
display: none;
}
</style>
<!-- Load Pako ZLIB library to enable PDF compression -->
<script src="~/Scripts/pako.min.js"></script>
<script type="x/kendo-template" id="page-template">
<div class="page-template">
<div class="header">
<div style="float: right">Page #: pageNum # of #: totalPages #</div>
Multi-page grid with automatic page breaking
</div>
<div class="watermark">KENDO UI</div>
<div class="footer">
Page #: pageNum # of #: totalPages #
</div>
</div>
</script>
<div class="box wide">
<p style="margin-bottom: 1em"><b>Important:</b></p>
<p style="margin-bottom: 1em">
This page loads
<a href="https://github.com/nodeca/pako">pako zlib library</a> (pako_deflate.min.js)
to enable compression in the PDF. This is highly recommended as it improves
performance and rises the limit on the size of the content that can be exported.
</p>
<p>
The Standard PDF fonts do not include Unicode support.
In order for the output to match what you see in the browser
you must provide source files for TrueType fonts for embedding.
Please read the documentation about
<a href="http://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#custom-fonts-and-pdf">custom fonts</a>
and
<a href="http://docs.telerik.com/kendo-ui/framework/drawing/pdf-output#using-custom-fonts">drawing</a>.
</p>
</div>
@(Html.Kendo().Grid<Bams.Models.ListePdf>()
.Name("grid")
.ToolBar(tools => tools.Pdf())
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks()
.PaperSize("A4")
.Scale(0.8)
.Margin("2cm", "1cm", "1cm", "1cm")
.Landscape()
.RepeatHeaders()
.TemplateId("page-template")
.FileName("Kendo UI Grid Export.pdf")
.ProxyURL(Url.Action("Pdf_Export_Save", "Test"))
)
.Columns(columns =>
{
columns.Bound(c => c.Id)
.Width(20).Title("Nr");
columns.Bound(c => c.Name).Width(50).Title("Name");
columns.Bound(c => c.Beschreibung).Width(50).Title("Beschr.");
columns.Bound(c => c.Hersteller).Width(30).Title("Herst.");
columns.Bound(c => c.Alias).Width(30).Title("Alias");
columns.Bound(c => c.Datums).Width(20).Title("Datum");
})
.HtmlAttributes(new { style = "height: 550px;" })
.Scrollable()
//.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("getListe", "Test"))
.PageSize(2)
)
)
<style>
/* Page Template for the exported PDF */
.page-template {
font-family: "DejaVu Sans", "Arial", sans-serif;
position: absolute;
left: 20px;
right: 20px;
font-size: 40%;
}
.page-template .header {
top: 10px;
border-bottom: 1px solid #000;
}
.page-template .footer {
bottom: 10px;
border-top: 1px solid #000;
}
</style>
What is Wrong?????