kendoGridPDFTemplate and paperSize 'auto' not compatible?

1 Answer 399 Views
Grid PDF Export
Tyler
Top achievements
Rank 1
Iron
Tyler asked on 17 May 2021, 03:05 PM

I am using a Kendo Grid component with a large variety of data set sizes, so I would like to use auto, but still make it multipage and have the PDF header and footer. I have this working with paperSize of A4 but when I set it to 'auto', then the header/footer templates do not show.

Is this a known issue? Currently using pdf-export 2.0.0, angular-grid 4.8.4

 

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 20 May 2021, 08:29 AM

Hi Tylor,

Setting the paperSize to a value different than the default 'auto' is indeed required in order for the repeated table headers to function as expected.

Regards,
Svetlin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tyler
Top achievements
Rank 1
Iron
commented on 20 May 2021, 03:33 PM

Thank you for the reply.

Then about a feature request: if we could set a page size of [ "auto", "8in" ] and then the PDF export could size the width to fit, but still perform page breaks where needed. Is this something that is supported now, or something that might be possible in future?

Thank you,
Tyler
Svet
Telerik team
commented on 25 May 2021, 12:11 PM

Hi Tyler,

Providing an array of values for the pagerSize option doesn't seem possible. However, could I ask you to elaborate a bit more on the suggested feature request so that we can discuss it with the dedicated developers and consider adding it to our public Feedback Portal. Thank you.

Tyler
Top achievements
Rank 1
Iron
commented on 25 May 2021, 01:29 PM

Thank you for the reply and the hope that we might be able to solve this somehow.

So the situation is as follows: we have a grid control that dynamically loads various data sets. It might be 3 columns, or it could be 15 columns. When we want to export to PDF, if there are many columns, it can be cut off on the right side when set to a defined page size. We can set to 'auto', but then we lose all page breaks - everything gets put on to one page.

My thought above was to be able to specify a paperSize of ["auto","8in"] similar to how we can specify an exact page size of ["20mm", "20mm"]. This would expand the paper width to fit the data, but still divide up the pages into constant heights and thus multiple pages. And this would also allow space for headers and footers.

An alternate approach might be to use a set paperSize like "A4" or "Letter" but have a scale option of "auto" which would size the grid/columns to fit the given width, and break on the given height. Again, with headers and footers available.

I hope that helps. Thank you very much for your time.
Svet
Telerik team
commented on 28 May 2021, 12:28 PM

Hi Tyler,

Thank you for the provided additional details. We checked the suggestions with the developers but decided not to log a Feature Request due to the following limitations.

Using paperSize="auto" extends the PDF content per page according to the exported content size. Thus the size for the header and footer aren't included in the calculation.

The PDFExport doesn't know when to use one paperSize option over the other. Instead the required option should be set by the developer. You can compute the size of the PDF page according to the size of the exported content as demonstrated on this article:

https://www.telerik.com/kendo-angular-ui/components/drawing/pdf-output/dimensions-css-units/

Based on the size of the exported content you can determine what paperSize option to set.

 

Tags
Grid PDF Export
Asked by
Tyler
Top achievements
Rank 1
Iron
Answers by
Svet
Telerik team
Share this question
or