5 Answers, 1 is accepted
Hello Stephan,
I was unable to reproduce the behavior in the following demo. Do you mean that only the current page is exported? If that is the case, you should enable the allPages option of the Excel export configuration.
Regards,Dimiter Madjarov
Telerik

Hi Dimiter,
Thanks for your response. Am generating pdf for my Kendo grid. As my grid is scrollable (shows only first 4 records and rest of the records can be viewed only after scrolling). All my records are within a single page. While generating pdf, it is showing the initial records (first 4 records that can be viewed without scrolling ) like a screenshot of the records, not the entire grid.
Also could you tell me how to set allPages option to true dynamically instead of setting it in kendo grid using js?

Also to add more information, am using mvc kendo grid. I need to combine three div in the page which include kendo grid div to create a single pdf in an button click event.
This is my piece of code.
getPDF: function (sendPdf) {
var self = this;
var root = new kendo.drawing.Group();
//Creating drawing for two form div
var x = document.getElementsByClassName(self.selectors.pdfSelector);
for (var i = 0; i < x.length; i++) {
kendo.drawing.drawDOM(x[i]).then(function (group) {
root.append(group);
});
}
//Creating drawing for Kendo grid
kendo.drawing.drawDOM(self.selectors.Grid).then(function (group) {
root.append(group);
});
//Appended all those in a single root group
return kendo.drawing.exportPDF(root, {
paperSize: "auto",
margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" },
multiPage: true
})
.done(function (data) {
// Save the PDF file
kendo.saveAs({
dataURI: data,
fileName: "IsciCode.pdf",
});
});
My problem is similar to this sample where grid in the pdf is incomplete
https://demos.telerik.com/kendo-ui/pdf-export/index
Hello Stephan,
I was unable to reproduce the behavior with both, allPages set to true and false. Here is a short example that demonstrates this. The behavior is the same in the MVC Grid.
Regarding the second question, you could achieve this via JavaScript through the Grid options.
E.g.
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
grid.options.pdf.allPages =
false
If you would like to add additional content to the PDF document and export all Grid pages, you could use the approach from the following help topic.
Regards,Dimiter Madjarov
Telerik

Thank you so much Dimiter. This is the part exactly what i expected, which initiate grid pdf creation programmatically.
grid._drawPDF(progress)