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:
<
link
rel
=
"stylesheet"
href
=
"https://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"https://kendo.cdn.telerik.com/2017.1.118/styles/kendo.blueopal.min.css"
/>
<
script
src
=
"https://kendo.cdn.telerik.com/2017.1.118/js/jquery.min.js"
></
script
>
<
script
src
=
"https://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js"
></
script
>
<
script
src
=
"https://kendo.cdn.telerik.com/2018.1.221/js/pako_deflate.min.js"
></
script
>
<%
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
>
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
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