简体   繁体   中英

Kendo Export as PDF

I am calling kendo.drawing.drawDOM method in #PrintPDF button click. When the button is clicked it goes to on success of the button click, there i am getting the partial view result. Now i want to pass this partial view result to be created as a pdf document. I am not sure how to pass the partial view result as input elements of kendo.drawing.drawDOM.

Note : $.parseHTML(result) does not work.

$("#PrintPDF").click(function () {         

        var url = "_PrintPDFPartialView";
        $.ajax({
            url: url,
            type: 'POST',
            data: {
                id: $("#StId").val()
            },   
     success: function (result) 
           {
             kendo.drawing.drawDOM($.parseHTML(result))
             .then(function (group) {
                 // Render the result as a PDF file
                 return kendo.drawing.exportPDF(group, {
                     paperSize: "auto",
                     multiPage: true,   
                     });
                 }).done(function (data) {    },
                    )};
           });

You can use this source

$("#PrintPDF").click(function () {         
    var url = "_PrintPDFPartialView";
    $.ajax({
        url: url,
        type: 'POST',
        data: {
            id: $("#StId").val()
        },   
 success: function (result) 
       {
             var $result = $(result);

         kendo.drawing.drawDOM($result)
         .then(function (group) {
             // Render the result as a PDF file
              kendo.drawing.pdf.saveAs(group, "test.pdf");
             }).done(function (data) {    },
                )};
       });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM