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

Grid rows vanish when exporting to PDF

1 Answer 503 Views
Grid
This is a migrated thread and some comments may be shown as answers.
B
Top achievements
Rank 1
Iron
B asked on 23 Feb 2018, 05:38 PM

I have a dynamically generated table that gets converted into a Kendo Grid. Whenever I try to export to a PDF the export works great but the grid rows disappear when it's done.  Interestingly, if i remove the paperSize, the lines stay there but the template is lost.  Here is my code:

 

 
<%
     var names = new List<string> {"Bubba", "Jane"};
 %>
    <table id="grid">
        <thead>
        <colgroup>
            <col style="width:320px"/>
            <col />
        </colgroup>
        <tr>
            <th data-title="Name"></th>
            <th data-title="Name 2"></th>
        </tr>
        </thead>
        <tbody>
        <%
 
            foreach (var item in names)
            {%>
            <tr>
                <td><%= item %></td>
                <td><%= item %></td>
            </tr>
        <%}
        %>
 
        </tbody>   
    </table>   
 
     
 
    <script type="x/kendo-template" id="page-template">
      <div class="page-template">
        <div class="header">
          Details
        </div>
        <div class="footer">
          Page #: pageNum # of #: totalPages #
        </div>
      </div>
    </script>  
     
 
    <script>
  
        $(document).ready(function () {
            $("#grid").kendoGrid({
                toolbar: ["pdf"],
                pdf: {
                    allPages: true,
                    avoidLinks: true,
                    paperSize: "A4",
                    margin: { top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" },
                    landscape: true,
                    repeatHeaders: true,
                    template: $("#page-template").html(),
                    scale: 0.5
                },
                height: "auto",
                sortable: true
            });
 
 
        });
    </script>
Nicole
Top achievements
Rank 1
commented on 31 Oct 2023, 08:18 PM

Hey,

I have a similar problem. I'm using Kendo UI integrated with Angular, and when exporting very large HTML, it loses the original formatting when exporting to A4.
If you remove the paperSize: "A4" it works fine, but it would not be possible to print, and that is why it does not solve my problem.

I need a help with this

Neli
Telerik team
commented on 02 Nov 2023, 10:18 AM

Hi Nicole,

I have replied yesterday in the support thread regarding the same issue. For convenience I will suggest keep the conversation in a single thread.

From the provided information I am not sure what might be the cause of the issue experienced on your end,

Could you please provide more information about the content that is exported and also the exact configuration you are using when exporting to PDF? This way we could try to reproduce the issue locally and get a better idea of what might be the cause of the observed issue.

Another thing that you could try is to place the same content in the Dojo linked here and check if the issue will be reproduced - https://dojo.telerik.com/@NeliKondova/ukahUXog

Looking forward to your reply.

Regards,

Neli

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 27 Feb 2018, 03:04 PM
Hello,

The problem is related to the HTML structure and specifically the colgroup element. Please refer to the http://dojo.telerik.com/iMExALaW/4 example where the pdf export should be fixed. 

Regards,
Boyan Dimitrov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Michael
Top achievements
Rank 1
commented on 12 Jun 2023, 09:52 AM

Hello

I have an identical issue. My Kendo Grid has 38 rows, 20 on page 1 and 18 on page 2. But when I export to PDF only the first 15 rows appear on page 1, the last 5 rows are missing. Page 2 is complete.

So where are my missing 5 rows??

(PS. The dojo referred to above doesn't really help)

Neli
Telerik team
commented on 14 Jun 2023, 07:14 AM

Hi Michael,

Could you please provide more information about the Grid configuration on your side? Are you using the built-in pdf export of the Grid? 

In the Dojo linked here the pageSize is set to 20 and when exported all 20 items of each page are available in the exported pdf file. May I ask you to modify the provided Dojo in order to replicate the behavior the way it is on your side and send it back, so we could take a closer look.

Looking forward to your reply.

Regards,

Neli

 

 

Tags
Grid
Asked by
B
Top achievements
Rank 1
Iron
Answers by
Boyan Dimitrov
Telerik team
Share this question
or