Please add a feature to export the grid to a PDF file.
---
ADMIN EDIT
We have made two examples you can use for the time being to get a PDF document from the grid:
---
Hi Ros,
That sample uses the Kendo Drawing API functionality to generate a PDF in the browser with JS based on the DOM.
Thus, it cannot have a server-side part directly. What you could consider, is either generating the headers with JS (see below), or sending the PDF from the browser to the server (instead of saving it for the end user) so the endpoint in the server can edit and handle the PDF it got according to your needs.
If you want to make a more complex PDF (such as add headers, footers, alter page size and so on), I recommend you review the documentation and examples of that product. Here is a few of them to get you started:
Note that there is some integration between the Kendo jQuery Grid and the Kendo Drawing API that is not available for the Blazor Grid component.
If you are having difficulties with the Kendo Drawing API after reviewing its API, functionality and resources, I recommend you open a new forum thread or support ticket with your questions for the particular situation/question, as this thread here is related to a built-in export of the Blazor Grid, that will likely not come through a jQuery library. Also, it will not combine external page elements either, it will handle exporting only the current grid data, so such a highly custom solution you are looking for will either be something you will have to code, or consider using actual reporting solutions to generate your complex reports based on data and report definitions, rather than trying to hack UI elements.
Regards,
Marin Bratanov
Progress Telerik
Hi Ros,
The sample you mentioned uses javascript and exports only the rendered DOM elements. This is why the pageable Grid in this example converts only the current page with rows.
Yet, you can achieve the desired result by using a custom PDF export. The other sample from my colleague's answer shows the needed result - Export Grid to PDF on the Server. This example shows how to build a custom PDF export on the server. You can test it to see if it covers your app requirements in the meantime.
Regards,
Hristian Stefanov
Progress Telerik
Hi Folks,
In https://github.com/telerik/blazor-ui/tree/master/common/pdf-jpg-export-js
any ideas how to make pdf document pageable ? By default in just add everything to one page. Just want to make it if content is over one page start to add it to next page. Also is it possible to add headers to each page in case if it is possible to make it pageable.
Thnks,
Ros
Hello all,
We have made a new example that shows how you can generate a PDF on the server based on the grid data source request which will also let you customize the file as needed. You can find sample projects for this here: https://github.com/telerik/blazor-ui/tree/master/grid/pdf-export-server.
Regards,
Marin Bratanov
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/.
Hi all,
You can find an example of using Kendo JS libraries to generate a PDF (and a JPG) out of the current DOM (for example, the current page of grid data) in this sample project: https://github.com/telerik/blazor-ui/tree/master/common/pdf-jpg-export-js.
You can use that in for the time being in projects that need this urgently, or you could generate larger PDF files (e.g., with all the data) through the Telerik Document Processing libraries (see here, here and here for starting points). If you need to do that with data according to the current grid filter, for example, you can cache the grid DataSource request (example) and re-run it on your backend (examples) without paging to get those filtered results.
A built-in PDF export from the grid the was put off because of performance reasons with WebAssembly scenarios. We are expecting improvements from .NET 5 to help with that, and we are also going to work on that internally (in our own product), and such a feature will eventually be implemented, so you can keep following this item for status updates. This page will be updated with a release number when we know when it will be available.
In place of this feature, we created grand total footers too.
Regards,
Marin Bratanov
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/.