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

Export Charts and Grids to Multipage PDF

3 Answers 186 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 07 Feb 2017, 12:53 PM

A have a chart and a grid with ~100 lines, then another chart with a grid with ~100 lines on a bootstrap built page with an export to PDF button on it. I can press the button and it will export all of the data to a single page. When it comes to printing the PDF the content is so small it's unreadable. This is the javascript to do that:

    // Convert the DOM element to a drawing using kendo.drawing.drawDOM
                    kendo.drawing.drawDOM($(".content-wrapper"))
                    .then(function (group) {
                        // Render the result as a PDF file
                        return kendo.drawing.exportPDF(group, {
                            paperSize: "auto",
                            margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" }
                        });
                    })
                    .done(function (data) {
                        // Save the PDF file
                        kendo.saveAs({
                            dataURI: data,
                            fileName: filename + ".pdf",
                            proxyURL: "//"
                        });
                    });

In both the drawDOM and exportPDF sections I have tried to set the page size to "A4" and multipage enabled, with and without page breaks but it never seems to scale the page properly and sometimes the charts just don't render at all.

The page is in sections and so could be split over multiple pages with a page break class.

What do I need to do to have the PDF page break correctly whilst staying at the correct scale?

3 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 09 Feb 2017, 01:02 PM
Hello Gary,

There seems to be a known issue related to the PDF Export and the Kendo UI Chart when exported in a multi-page document. I ran some tests locally and I can confirm that scaling works well with the previous Kendo UI version - 2016.1.118:

http://dojo.telerik.com/UkoGE 

For multipage export, you can set the paperSize on the root level as noted at:
http://docs.telerik.com/kendo-ui/framework/drawing/pdf-output#configuration-Multi-Page

Automatic page breaking and its limitations are listed at:
http://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#configuration-Automatic

The other options which you have mentioned are also fully supported as an alternative to automatic page breaking - the forcePageBreak and keepTogether options.

I will get back to today once I have logged the issue and assigned a developer to look into it.

Regards,
Alex Hajigeorgieva
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Alex Hajigeorgieva
Telerik team
answered on 09 Feb 2017, 02:15 PM
Hi Gary,

Just a quick note to let you know that I have now logged this issue and assigned a developer to fix so you may follow its progress at:

https://github.com/telerik/kendo-ui-core/issues/2750

Kind Regards,
Alex Hajigeorgieva
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Gary
Top achievements
Rank 1
answered on 09 Feb 2017, 02:19 PM

Hi Alex,

Thanks for investigating this for me and finding a solution. I did a basic check and it appeared to work well, so I'll update my project with the slightly older kendo.ui javascript and test some of the manual page breaking, to find what works the best.

Thanks again,

Gary

Tags
Charts
Asked by
Gary
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Gary
Top achievements
Rank 1
Share this question
or