Hello,
I have a hierarchical grid and I want to export it to pdf, but when I do this, only 2 pages are created, the rest is cut.
Can anybody tell me what I have to set, so that the complete grid is exported?
I also have another problem with the grid. The ProxyURL-Function does not work. The according method in code behind is never be executed and I don't know why.
Here is the code:
<div class=
"col-sm-12"
id=
"main"
>
@(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MachineInfo>()
.Name(
"grid"
)
.ToolBar(tools => tools.Pdf())
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks()
.PaperSize(
"A4"
)
.Scale(0.8)
.Margin(
"2cm"
,
"1cm"
,
"1cm"
,
"1cm"
)
.Landscape()
.TemplateId(
"page-template"
)
.FileName(
"Kendo UI Grid Export.pdf"
)
.ProxyURL(Url.Action(
"Pdf_Export_Save"
,
"Home"
))
)
.HtmlAttributes(
new
{ style =
"height: 800px; width:1000px"
})
.Scrollable(scrollable => scrollable.Height(
"auto"
))
.Groupable()
.Sortable()
.ClientDetailTemplateId(
"TemplateMaterial"
)
.DataSource(dataSource => dataSource
.Ajax()
//.PageSize(10)
.Read(read => read.Action(
"getSpGrid"
,
"Home"
))
)
.Events(events => events.DataBound(
"dataBound"
))
)
<script id=
"TemplateMaterial"
type=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MaterialInfo>()
.Name(
"grid_#=msn_pkfk_serialnr_vchar#"
)
// template expression, to be evaluated in the master context
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"HistorianBinding_Material"
,
"Home"
,
new
{ SerialNr =
"#=msn_pkfk_serialnr_vchar#"
}))
)
.Events(events => events.DataBound(
"dataBound"
))
.Sortable()
.ToClientTemplate()
)
//And the Code in HomeController
[HttpPost]
public
ActionResult Pdf_Export_Save(
string
contentType,
string
base64,
string
fileName)
{
var fileContents = Convert.FromBase64String(base64);
return
File(fileContents, contentType, fileName);
}