Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have requirement where i need to download enitre html page its downloading properly but need to exlude we buttons like Generate report and run report.

What I have tried:

function getPDF(selector) {

     kendo.drawing.drawDOM($(selector)).then(function (group) {
         return kendo.drawing.exportPDF(group, {

             margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" }
         });
     })
         .done(function (data) {
             // Save the PDF file
             kendo.saveAs({
                 dataURI: data,

                 fileName: "Reporting.pdf",

             });
Posted
Updated 5-Dec-19 8:10am
Comments
Chinnu2020 9-Dec-19 13:46pm    
i have a button on UI page and this needs to be disable when i click on second Tab in kendo tab strip.

1 solution

Try something like this:
JavaScript
function getPDF(selector) {
    var element = $(selector);
    var buttonsToHide = element.find("button:visible").hide();
    
    kendo.drawing.drawDOM(element).then(function(group) {
         return kendo.drawing.exportPDF(group, {
             margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" }
         });
    }).then(function(data){
        kendo.saveAs({ dataURI: data, fileName: "Reporting.pdf" });
    }).always(function(){
        buttonsToHide.show();
    });
}
 
Share this answer
 
v2
Comments
Chinnu2020 5-Dec-19 14:20pm    
Thanks... Button is disappearing but after clicking export button export button is disapperating.. finally block is not executing..
Richard Deeming 5-Dec-19 14:28pm    
Maybe it's returning a jQuery Deferred object instead of a proper Promise. Try using always instead of finally.
Chinnu2020 5-Dec-19 14:34pm    
i have Kendo Tabsstrip with three Tabs, can i hide tab 2 and Tab 3 also?
Richard Deeming 5-Dec-19 14:42pm    
Renaming / hiding tabs in UI for ASP.NET MVC TabStrip - Telerik Forums[^]

Hide the tabs at the start, and show them again in the always block.
Chinnu2020 6-Dec-19 6:13am    
Thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900