This is a migrated thread and some comments may be shown as answers.

Export all pages to PDF

18 Answers 828 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 19 Nov 2014, 09:12 PM
There is a setting for exporting all pages to Excel ("allPages"), but there does not appear to be one for PDFs. Is there no way to export everything to a PDF?

Frank Wanicka

18 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Nov 2014, 10:10 AM
Hello Frank,

The PDF export renders the currently visible DOM tree of the grid in order to provide similar look and feel. To render all pages you need to disable paging so all pages are visible at the time of export.

Excel export works only with the data of the grid and doesn't care about the visible DOM. This is why it supports exporting all data.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Frank
Top achievements
Rank 1
answered on 20 Nov 2014, 02:12 PM
Well, I would like to suggest you add that ability as an enhancement then. Having two export buttons that produce completely different output is completely counterintuitive. As of right now, the export functionality is unusable for us. We need to be able to export to Excel and PDF and have it produce the same output.

I guess we'll have to stick with our code that generates the export on the server, which is unfortunate, because I was really looking forward to this out-of-the-box functionality.

Frank Wanicka
0
Atanas Korchev
Telerik team
answered on 20 Nov 2014, 04:00 PM
Hello Frank,

The default configuration of Excel export doesn't export all pages. This means that by default Excel and PDF export will use the current page of data. If you want to export all pages in PDF and use the built-in export you have to disable paging.

We will look into providing some support or workaround for all pages. It is rather difficult though because the grid should render all pages one by one during PDF export. This won't perform well with a large number of pages due to the number of DOM changes.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bryan
Top achievements
Rank 1
answered on 03 Jan 2015, 01:27 AM
I agree with Frank. I was really looking forward to this functionality, but limiting it to the current page makes it useless.
0
T. Tsonev
Telerik team
answered on 06 Jan 2015, 08:55 AM
Hi,

We're currently working on making multi-page export a feature.

I've attached a sample that you can run against the current internal build.
It still requires user code and will not be a built-in feature until at least the Q2 release in March.

Thank you for your patience.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Michael
Top achievements
Rank 1
answered on 05 Mar 2015, 11:49 PM
Which internal build can this be run against? 

At present we're having some issues with our subscription so we're not able to download internal builds. 
0
T. Tsonev
Telerik team
answered on 09 Mar 2015, 08:50 PM
Hello,

I'm attaching the latest internal build here for your convenience.
I had to remove the demos and source code to get it into the file size limits.

I'd also like to inform you that the Q2 version will support built-in support for exporting all pages.
A beta is available right now with the official release scheduled for next week.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sathick
Top achievements
Rank 1
answered on 06 Apr 2015, 07:55 AM

I downloaded the Q2 2015 version(with hotfix) but still unable to Export All the Pages using pdf. Please suggest a workaround.

 

0
Atanas Korchev
Telerik team
answered on 07 Apr 2015, 08:47 AM
Hi,

You need to download the Q1 2015 version to get this feature. Then make sure you have set the pdf.allPages option to true.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lynx IT
Top achievements
Rank 1
answered on 13 May 2015, 12:44 AM
Hi, I have just updated our Kendo JS to the latest released build which does have support for the allPages export to PDF. However the resultant PDF is not formatted correctly. It appears as though the grid iterates through each page of the grid to render the pages for PDF but the first page of the grid is plastered over the top of the subsequent pages. Is this a known issue? or is there a workaround to prevent this result?
0
Atanas Korchev
Telerik team
answered on 13 May 2015, 06:26 AM

Hello Lynx IT,

No, this is not a known issue. Can you reproduce it in this demo

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lynx IT
Top achievements
Rank 1
answered on 18 May 2015, 06:09 AM
I have been unable to reproduce the issue in the demo however I have noticed that on our site the progress bar does not display, and I can see all the rendering happening on the UI as the PDF is being generated. This is a clear difference to the behaviour I am seeing with the demo code.
0
T. Tsonev
Telerik team
answered on 19 May 2015, 04:09 PM

Hello,

It sounds a lot like the old version is still in use. Can you please check if the new scripts have been loaded?

Try the following in the browser console:

> kendo.version

Does this show 2015.1.318 or later?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lynx IT
Top achievements
Rank 1
answered on 19 May 2015, 11:16 PM
We are definitely using the right version of the code, but I don't think we are using the newest version of the CSS. Have there been additions to the style sheet that are required for the multi page rendering to work correctly?
0
Lynx IT
Top achievements
Rank 1
answered on 19 May 2015, 11:34 PM
That was the issue. As soon as I added the styles used by the PDF export code the resultant PDF rendered correctly.
0
Mark
Top achievements
Rank 1
answered on 30 Sep 2015, 05:06 PM

We are using version: 2015.2.805 and if I add "allPages" to the javascript definition, the browser hangs.  Doesn't matter which browser(IE, Firefox, Chrome), they all hang...I am only pulling 107 records.  I tried to put them on one page, but then they were REALLY small on the pdf so I am trying multiple pages now.  I really need to get this working if possible.  Will include my Grid definition below.  There is NOTHING else in the view except a small header which I don't care about.  Just want to export the Grid.  Version of Jquery I am using is:  2.1.4.  Not sure if that is part of the problem or not.

Thanks again... 

 

Grid definition.

 

<div id="grid"></div>


<script>
    $(document).ready(function () {
        $("#grid").kendoGrid({
            dataSource: {
                type: "json",
                sort: [
                    {field: "DepartmentName", dir: "asc"},
                    {field: "FullName", dir: "asc"}
                ],
                transport: {
                    read: "/api/Person"
                },
                pageSize: 30,
                group: { field: "DepartmentName" }
            },
            dataBound: function(e) {
                exportGrid();
            },
            pageable: true,
            groupable: false,
            pdf: {
                allPages: true,
                fileName: "​ourfilename.pdf",
                landscape: false,
                multiPage: true,
                margin: {
                    left: 25,
                    right: 25,
                    top: 25,
                    bottom: 25
                },
                //paperSize: "A4",
                title: "Directory",
                subject: "Directory"
            },
            columns: [
                {
                    //template: "<a href=\"/Person/Edit/#:data.Id#\">#:data.FullName#</a>",
                    field: "FullName",
                    title: "Name",
                    width: 300
                }

            , {
                field: "Title",
                title: "Title"
            },

            {
                field: "DepartmentName",
                title: "Department",
                groupHeaderTemplate: "#= value #", hidden: true
            }
            , {
                field: "PhoneExtension",
                title: "Phone"
            }
            ],pdfExport: function(e) {
                e.promise
                .progress(function(e) {
                    //console.log(kendo.format("{0:P} complete", e.progress));
                })
                .done(function () {
                    //window.showInfo("PDF Download", "Export Complete!");
                    //alert("Export completed!");
                });
            }
        });

    });
    //$("#grid").data("kendoGrid").saveAsPDF();
    function exportGrid()
    {
        var grid = $("#grid").data("kendoGrid");
        grid.saveAsPDF();
    }
   
</script>

0
Mark
Top achievements
Rank 1
answered on 30 Sep 2015, 05:18 PM
Also, I will attach an image of the break in the JQuery code.  It might help out?
0
T. Tsonev
Telerik team
answered on 02 Oct 2015, 02:38 PM
Hi,

Based on my test snippet I would advise against calling saveAsPDF in the dataBound handler.

The allPages option will page the data source, so you'll get an endless recursion as a result.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Frank
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Frank
Top achievements
Rank 1
Bryan
Top achievements
Rank 1
T. Tsonev
Telerik team
Michael
Top achievements
Rank 1
Sathick
Top achievements
Rank 1
Lynx IT
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or