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

PRINTING TreeList Help

7 Answers 94 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 18 Sep 2014, 07:26 PM
I am looking to print a TreeList without having the dependency of Excel or PDF. Is there a method other than exporting the innerHTML onto a page and printing the new page?

7 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 23 Sep 2014, 11:09 AM
Hi Jacob,

The current version of the RadTreeList control does not provide a standalone print method for directly printing its content. Possible approach is to use the browser direct print option or any third party library for achieving such functionality.
As you already mentioned this could be also done by firstly export the content and then print the html.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Doug
Top achievements
Rank 1
answered on 28 Sep 2016, 04:31 PM
The innerHtml method does not export data in the required format. Can you provide a list of 3rd party libraries available to print TreeList?
0
Maria Ilieva
Telerik team
answered on 03 Oct 2016, 09:07 AM
Hello,

You can use the Kendo UI Drwaing library for achieving the required functionality. For example:

var that = $find("RadTreeList1");
var kendo = window.kendo;
var $printingContainer;
 
if ($telerik.isIE || Telerik.Web.Browser.edge) {
    var printWindow = window.open();
 
    if (!printWindow) return false;
 
    $printingContainer = $telerik.$("<div>");
 
    kendo.drawing.drawDOM(that.get_element()).then(function (group) {
        return kendo.drawing.Surface.create($printingContainer, { type: "svg" }).draw(group);
    }).done(function (data) {
        var html = "<html><head>" + that._getHeadLinksForPrint() + "</head><body><form style='height:" + that.get_element().scrollHeight + "px;'>" +
            $printingContainer.get(0).innerHTML + "</form></body></html>";
        printWindow.document.open();
        printWindow.document.write(html);
        printWindow.document.close();
        printWindow.print();
        $printingContainer.remove();
    });
} else {
    kendo.drawing.drawDOM(that.get_element())
    .then(function (root) {
        return kendo.drawing.exportPDF(root);
    })
    .done(function (data) {
        window.open(data, '', false);
    });
}

Give this a try and verify if it works for you.

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Doug
Top achievements
Rank 1
answered on 03 Oct 2016, 07:07 PM
This does work when fewer items need to be printed in a collapsed state and the page size is less than 1, but the screen is blank when trying to print data after expanding all the nodes. I have attached both the screenshots below. I need to be able to print about 600 to 1000 rows sometimes. How do I make this work for large amounts of data?
0
Konstantin Dikov
Telerik team
answered on 07 Oct 2016, 08:25 AM
Hi Doug,

With huge amount of records you will not be able to use this approach and you might consider using the built-in Export To PDF functionality of the RadTreeList and print the content from the generated PDF file:


Regards,
Konstantin Dikov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Doug
Top achievements
Rank 1
answered on 07 Oct 2016, 12:54 PM
I want to be able to print the data from the user screen, without having to export to a separate pdf or excel file. I tried exporting the innerHTML to a new page and printing it, but that was not user friendly. Is there any other way I can do this without having to export the data to Excel, word or pdf?
0
Kostadin
Telerik team
answered on 12 Oct 2016, 12:01 PM
Hi Doug,

A possible solution is to manually break the pages so you can export the content in a multiple files. I would recommend you to examine the following help article which elaborates more on this matter.

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
TreeList
Asked by
Jacob
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Doug
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Kostadin
Telerik team
Share this question
or