This is a migrated thread and some comments may be shown as answers.

Grid PDF Export Can't get repeatHeaders to work

4 Answers 463 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 17 Apr 2017, 08:50 PM

Hello,

I'm using the following code to export a grid with a few hundred rows:

kendo.drawing.drawDOM($("#resultsGrid"),
    {
        allPages: true,
        avoidLinks: true,
        paperSize: "A4",
        multiPage: true,
        landscape: true,
        margin: { top: "4cm", right: "1cm", bottom: "1cm", left: "1cm" },
        repeatHeaders: true
    }).then(function (documentgroup)
    {
        kendo.drawing.pdf.saveAs(documentgroup, "myfile", "pdf"));
    });

 

The pdf settings on the grid look like this:

pdf: {
    allPages: true,
    repeatHeaders: true
},

 

The grid exports fine but does not repeat the headers on each page.  They are only present on the first page.  Any ideas what would prevent "repeatHeaders: true" from repeating the headers on every page of the exported PDF file?

Thanks,

Jonesy

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Apr 2017, 06:59 AM
Hello Scott,

After inspecting the provided code, it looks good, but is there a specific reason for using two different approaches to export the Grid?

If the Grid is using only the built-in options for PDF export the data is exported as expected:

http://dojo.telerik.com/IMoDI

I can assume that there is a custom factor which we are overlooking at this moment. Please provide a runnable example reproducing the issue and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Scott
Top achievements
Rank 1
answered on 19 Apr 2017, 04:42 PM

Thanks for your response.  I used drawDOM because I needed to customize margins, paper size, and the template based on what was selected in a drop down.  I also couldn't get the built-in PDF export to produce all of the data.  It only displayed one page, with everything that didn't fit the page, not exported into the PDF file.  

The drawDOM method works great for me, except that it doesn't repeat the grid header on each page of the PDF file.  I was hoping you would have a simple suggestion for that. If I can't figure out something soon I'll put together a runnable example. 

0
Scott
Top achievements
Rank 1
answered on 19 Apr 2017, 04:59 PM
I think that the problem might be due to the version of Kendo UI being used.  It is, "Kendo UI v2016.1.226".  I need to see if i can get the company to upgrade.  
0
Stefan
Telerik team
answered on 21 Apr 2017, 08:36 AM
Hello Scott,

In general, the same pdf options can be set from the Grid configurations as well. Please check all of the available configurations options:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-pdf

As for exporting only one of the pages, we have a known issue which is ready for testing, and it is connected to the scrollable property of the Grid. If the property is set to false, the Grid will export only the first page.

Also, if the issue is not directly connected to the used version, please send a fully runnable example, and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Scott
Top achievements
Rank 1
Share this question
or