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

Print with resize

2 Answers 16 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Lucy
Top achievements
Rank 1
Lucy asked on 30 Nov 2018, 12:48 AM

     I'm using telerik HTML 5 chart in the page which gets rendered along with bunch of other tables. so the page contains few tables, couple of paragraphs and telerik HTML5 charts in between them. 

I'm using this https://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/responsive-chart/defaultvb.aspx link as reference for resizing the window. However when i try to do print the charts are not getting resized.

 

I'm using Area chart and Bar chart https://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/areachart/defaultvb.aspx 

 

But the resize on print doesnt work, can you help out with this issue? how to do print with resize feature, so that the chart doesnt get cutoff. Any help will be highly appreciated.

2 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 11 Dec 2018, 03:36 PM
Hi Lucy,

You can repaint the Charts in the PdfExporting client-side event. For example, if you have a div element with id divtoPrint that contains everything you need to export, you can set its width before exporting, for example using a similar approach.

function exportElement() {
    var exp = $find("<%= RadClientExportManager1.ClientID %>");
    var divtoPrint = $telerik.$("#divtoPrint");
    var originalWidth = divtoPrint.width();
    divtoPrint.width("1000px")
    $telerik.$("#divtoPrint").find(".RadHtmlChart").each(function (index, elem) {
        if (elem && elem.control && elem.control.repaint) {
            elem.control.repaint();
        }
    });
  
    exp.exportPDF($telerik.$("#divtoPrint"));
}

If the issue persists, please prepare a simple runnable project and send it to us in an official support ticket. That would allow us to investigate your exact scenario locally and help you more efficiently.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Lucy
Top achievements
Rank 1
answered on 15 Jan 2019, 05:01 PM
Thank you! It works now!
Tags
Chart (HTML5)
Asked by
Lucy
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Lucy
Top achievements
Rank 1
Share this question
or