Export grid to PDF is not creating page breaks

1 Answer 66 Views
Grid PDFViewer
Christopher
Top achievements
Rank 1
Iron
Christopher asked on 13 Jun 2023, 02:41 PM

Hello,

I'm using a Grid control with virtual scrolling.  When I export to PDF, the content runs right off of the bottom of the page without breaking to a new page.  

I have my datasource's page size set to 100 records to limit the number of times the grid will need to fetch new data from the server.  If I change this to only 5 records, for example, then the PDF will create a page break after 5 records.  However, I am also using grouping on the data.  If every row is in its own group, I can get about 6 or 7 rows onto a page.  If every row falls under the same group, I can get about 13-15 rows onto a page.  Because the number of rows per page may vary, I can't resort to setting the page size on the datasource.

My main concern at the moment is getting automatic page breaking to work.   In the screenshot I've attached, you can see that there is still some data at the very bottom of the page that is cut off.  There should be 11 rows of data, across 6 groups, but only 9 rows manage to fit onto the page.  Relevant code below:


.Pdf(pdf => pdf .FileName("BidAwards.pdf") .AllPages() .PaperSize("A4") .Landscape() .AvoidLinks() )

.DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(100)
                    .Events(events => events.Error("error_handler"))
                    .Model(model => model.Id(col => col.BidId))
                    .Read(read => read.Action("BidAwardGridData", "Reports", Model))
                    .Group(groups => groups.Add(col => col.GroupValue))

                )

 

I'd also like to find a way to keep entire groups of rows on a page if possible.  In other words, if the whole group won't fit on the remainder of the page, break to a new page for that group. 

Unfortunately, for the time being I'm stuck on an older version of the Telerik controls, and can't easily update until after this development cycle is completed (unless it's necessary to fix this).

 

Thanks!!!

1 Answer, 1 is accepted

Sort by
0
Christopher
Top achievements
Rank 1
Iron
answered on 14 Jun 2023, 06:36 PM

I ended up just updating my Kendo controls, which meant updating several other projects including my .Net framework (hence why I was hesitant to update).  But, this did seem to resolve the issue I had, and the pages are breaking correctly now.

I'm guessing that the older version I was using just had a bug with virtual scrolling and pdf exports.

Tags
Grid PDFViewer
Asked by
Christopher
Top achievements
Rank 1
Iron
Answers by
Christopher
Top achievements
Rank 1
Iron
Share this question
or