1) My primary question is speed for large data sets. If Kendo UI exports the data in this grid that contains 3475 records it takes 14-15 minutes. The resulting PDF is fine but the time taken is not practical.
Are there any options here?
2) Any additional options for this in terms of adding rows, graphics etc.?
3) Are there any options for converting an Excel file to PDF using Kendo?
10 Answers, 1 is accepted

I found this link for exporting to PDF:
https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview
Will this work for .NET Core? And will it be any faster for converting XLSX to PDF?
In general I would suggest to take a look and check the https://docs.telerik.com/kendo-ui/framework/drawing/pdf-tabular-data solution if this will work for your case. Please note that this solution only exports data as pdf tabular data. It does not offer header customization like having images or anything special like this. It only exports the data in tabular format. It does perform better with large data sets compared to the grid pdf export algorithm.
Hope that this will be helpful.
Regards,
Boyan Dimitrov
Progress Telerik

Hello,
This link does bot work for me. I should have mentioned this application is using Kendo UI Core MVC.
My name is Alex and I am taking over this thread while my colleague Boyan is away.
I believe that the suggestion is still valid and it is worth a shot because the static method uses an algorithm which is better than the built-in one for the grid in terms of performance, partly because it is simpler.
This is the last client-side option that can be tried and to use it in an MVC application, you would need a custom toolbar button, a click handler and the function itself, I tested it with 3475 records and it took 12 seconds:
*Test with server operations false. In case you are happy with the result, we can create another data source which will be a copy of the grid's data source but without a pageSize so all the records can be available at the time of export.
@(Html.Kendo().Grid<SomeModel.Models.OrderViewModel>()
.Name(
"grid"
)
.ToolBar(t=>t.Custom().IconClass(
"k-icon k-i-pdf"
).Name(
"CustomExport"
).Text(
"Export to PDF"
))
.DataSource(ds => ds
.Ajax()
.ServerOperation(
false
)
<script>
$(document).ready(function () {
$(
".k-grid-CustomExport"
).on(
"click"
, function () {
var grid = $(
"#grid"
).data(
"kendoGrid"
);
kendo.spreadsheet.drawTabularData({
dataSource: grid.dataSource,
columns: grid.columns,
headerBackground:
"#567"
,
headerColor:
"#fff"
,
evenBackground:
"#eee"
,
landscape:
true
,
scale:0.8
}).then(function (group) {
kendo.pdf.saveAs(group,
"test.pdf"
);
});
});
});
</script>
As far as the server side options, the Kendo UI Document Processing Libraries do not have a dll for ASP.NET Core but they do have an item in their FeedBack portal. Could you please take a moment to upvote it? The more popular it gets, the sooner they will start working on it:
https://feedback.telerik.com/document-processing/1356226-document-processing-provide-version-for-net-core
Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Hi Alex, thank you for providing the help.
I did vote on this.
My followup is this. With your code it now takes about 1 minute to export to PDF. That is a lot better than the 15 minutes it took before. But the resulting PDF still contains two unwanted elements per page, the Grouping Header and the Paging Footer. Is it possible in the code to remove them?
I includes this and it seems to have no effect :
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks(true)
//.PaperSize("A4")
//.Scale(0.8)
.Scale(1.5)
//.Margin( top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" )
.Margin("2cm", "1cm", "1cm", "1cm")
//.Landscape()
.RepeatHeaders(false)
.TemplateId("page-template")
.FileName("MCC_DataExport_ZenerDiodes.pdf")
//.ProxyURL(Url.Action("Zener_PDF_Export_Save", "DataExport"))
)
<script type="x/kendo-template" id="page-template">
<div class="page-template">
<div class="header">
<div style="float: right">Page #: pageNum # of #: totalPages #</div>
Multi-page grid with automatic page breaking
</div>
<div class="watermark">MCC</div>
<div class="footer">
Page #: pageNum # of #: totalPages #
</div>
</div>
</script>
(styles are included as well but I did not copy them here for brevity)
I also noticed that in setting ServerOperation(false) takes over twice as long for the data to load than it did with ServerOpteration(true). Why is that?
Thanks
The Kendo UI Grid built-in export has the ability to modify the PDF output by targeting the elements with the help of the .k-pdf-export class.
https://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#the-k-pdf-export-class
So to exclude the grouping header and the pager, you may add the following CSS rules:
<style>
.k-pdf-export .k-grouping-header,
.k-pdf-export .k-pager-wrap
{
display
:
none
;
}
</style>
However, the suggestion I made, uses only the data and it disregards any templates, grouping or pagers so I am a little unsure what is the sought after outcome in regards to that.
Here is a Dojo which has both of these options. Can you let me know what you would like to remove and from which export? Perhaps a screenshot with an indication would be helpful.
https://dojo.telerik.com/@bubblemaster/oHIMAvaJ
Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Hi Alex, thanks for staying with me on this issue.
I took a look at the link you provided and the difference in my solution is that I am not initializing the grid in JavaScript as is used on that demo.
I am using Kendo UI Core MVC and the grid is declared and configured in markup. The PDF is being generated correctly for the most part but the #template on the page does not get applied. Yet with the code below the filename is coming through, yet the template is being ignored and other properties like Headers are showing on every page. :The footer is not coming through.
Pdf(pdf => pdf
.AllPages()
.AvoidLinks(true)
.Author("MCC")
.Title("MCC Zener Diodes")
.RepeatHeaders(false)
.Scale(1.5)
.Margin("2cm", "1cm", "1cm", "1cm")
.
RepeatHeaders(false)
.TemplateId("page-template")
.FileName("MCC_DataExport_ZenerDiodes.pdf")
)
.
The reason for this behavior is due to the fact that paperSize is not set and it is missing from the configuration. Please refer to the pdfTemplate where we state that paperSize should be set in order the template to work.
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks()
.PaperSize(
"A4"
)
.Margin(
"2cm"
,
"1cm"
,
"1cm"
,
"1cm"
)
.Landscape()
.RepeatHeaders()
.TemplateId(
"page-template"
)
.FileName(
"Kendo UI Grid Export.pdf"
)
.ProxyURL(Url.Action(
"Pdf_Export_Save"
,
"Grid"
))
)
Regards,
Boyan Dimitrov
Progress Telerik

Hello,
The only difference from my code to what you just posted was the .PaperSize("A4")
When I un-comment that out the process hangs basically and I have to terminate the browser. Using Chrome.
Before it hangs the browser flashes the rendered page (flashes for about 1 sec) and you can see many rows with blank data, then it hangs even after stopping the debugger.
The Pako Deflate library if not included can help a lot with any PDF Export over 1MB:
<!-- Load Pako Deflate library to enable PDF compression -->
<
script
src
=
"http://kendo.cdn.telerik.com/2019.1.220/js/pako_deflate.min.js"
></
script
>
In case the browser is unresponsive with the library included, then the only other on the client is the static method I mentioned earlier:
https://www.telerik.com/forums/data-exporting-to-pdf-questions#E6543S23WU2FdpeFx95PbQ
If the static method does not help, then the data set must be too large for the browser memory and one should consider using server-side export. Our Document Processing team has been working on a version to support ASP.NET Core and you can check out the latest information about it in this feature request item together with instructions on how to download and use it:
https://feedback.telerik.com/document-processing/1356226-document-processing-provide-version-for-net-core
Kind Regards,
Alex Hajigeorgieva
Progress Telerik