将AngularJS srmart表导出为PDF?

时间:2016-05-05 06:00:58

标签: c# asp.net angularjs

HTML

<button class="btn m-b-xs btn-md btn-primary btn-addon" ng-click="printpdf()"><i class="fa fa-file-pdf-o"></i>Download To Pdf</button>

的js。

 $scope.printpdf = function () {
    var mywindow = window.open('', '', 'height=400,width=600');
    mywindow.document.write('<html><head><title>Test</title>');

    mywindow.document.write('</head><body >');
    //var blob = new Blob([document.getElementById('exportable').innerHTML]);
    mywindow.document.write([document.getElementById('exportable2').innerHTML]);
    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10
    mywindow.print();
    saveAs(mywindow, "Monthly Summary Report.pdf");
    mywindow.close();
    return true;
}

我使用此功能导出为PDF。它工作正常,但当我点击&#34;下载到Pdf&#34;这次打开打印对话框。我只需打开保存对话框到pdf。

0 个答案:

没有答案