PDF export repeat headers isn't working

1 Answer 119 Views
Grid
Christian
Top achievements
Rank 1
Christian asked on 14 Dec 2023, 10:19 PM

I am trying to get the export PDF of my grids to have the heads repeated on each page. Following the awful documentation I have been unable to get it to work. Some of the other functions work and others are ignored, however I'm only concerned about the headers. 

Here is my grid code:

		@(Html.Kendo().Grid<TheGridName>()
				.Name("mainGrid")
				.HtmlAttributes(new { @class = "gridHeight"})
				.Columns(col =>
				{
					col.Bound(c => c.col1).Title("Test 1");
					col.Bound(c => c.col2).Title("Test 2");
					col.Bound(c => c.col3).Title("Test 3");
					col.Bound(c => c.col4).Title("Test 4");
					col.Bound(c => c.col5).Title("Test 5");
					col.Bound(c => c.col6).Title("Test 6").;
				})
				.ToolBar(toolbar =>
				{
					toolbar.Excel();
					toolbar.Pdf();
				})
				.Pdf(pdf => pdf
					.AllPages(true)
					.AvoidLinks(false)
					.PaperSize("8in" , "11.5in")
					.Margin("2cm", "1cm", "1cm", "1cm")
					.Landscape(true)
					.Scale(0.8)
					.RepeatHeaders(true)
					.FileName("Kendo UI Grid Export.pdf")
					.ProxyURL(Url.Action("Pdf_Export_Save", "Grid"))
				)
				.Sortable()
				.Scrollable()
				.Filterable()
				.Resizable(r => r.Columns(true))
				.Reorderable(r => r.Columns(true))
				.Excel(excel => excel
				.FileName("test.xlsx"))
				.Events(x =>
				{
					x.ExcelExport("excelExport");
				})
				.ColumnMenu()
				.DataSource(ds => ds.Ajax()
				.Read(r => r.Url($"?handler=Read").Data("dataFunction"))
				.ServerOperation(false)
				))
Nothing fancy, just basic out of the box stuff. 

My Kendo and other important includes:
<script src="https://kendo.cdn.telerik.com/2023.1.314/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.314/js/kendo.aspnetmvc.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>

I'm guessing, like a lot of other features, this doesn't work in ASP.NET Core and this is some kind of copy paste error on Telerik's part and this only works in the jQuery version or something. 
Christian
Top achievements
Rank 1
commented on 14 Dec 2023, 10:32 PM

Just so you know I've tried all kinds of different permutations of Repeat Headers:

repeatHeaders
repeatheaders
RepeatHeaders
repeat-headers

and so on as I have seen it done in many many different ways across different documentation and posts. 

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 19 Dec 2023, 02:20 PM

Hi Christian,

Thank you for sharing your code.

I have tried out a PDF Export of Grid configuration that is very similar to the one you have shared. You can review it in this Telerik REPL.

But I wasn't able to replicate the issue. Could you please record the Grid's export behavior in a Fiddler Jam log with the following options enabled:

This will enable me to follow the actions you have taken on the client-side and review the server responses as well as the serialization of the server-side wrappers on the client. That will allow me to confirm or repeal you suspicion that the issue arises in the server-side Telerik wrappers. 

With more clarity about the cause of the experienced behavior I would be able to propose a course of action going forward.

Thank you for your consideration and cooperation in advance.

Regards,
Stoyan
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or