Grid PDF Export Can't get repeatHeaders to work

5 posts, 0 answers
  1. Scott
    Scott avatar
    22 posts
    Member since:
    Mar 2011

    Posted 17 Apr 2017 Link to this post

    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

  2. Stefan
    Admin
    Stefan avatar
    2834 posts

    Posted 19 Apr 2017 Link to this post

    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 visualization (charts) and form elements.
  3. Scott
    Scott avatar
    22 posts
    Member since:
    Mar 2011

    Posted 19 Apr 2017 in reply to Stefan Link to this post

    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. 

  4. Scott
    Scott avatar
    22 posts
    Member since:
    Mar 2011

    Posted 19 Apr 2017 in reply to Stefan Link to this post

    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.  
  5. Stefan
    Admin
    Stefan avatar
    2834 posts

    Posted 21 Apr 2017 Link to this post

    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.
Back to Top