export pdf in angularjs

306 views
Skip to first unread message

Muhammad Omer

unread,
Mar 17, 2015, 2:22:03 AM3/17/15
to ang...@googlegroups.com
Hello all,

i want to know that how can i export pdf file from angularjs. ive exported excel file and it is working fine.

following is code for excel


    $scope.exportData = function () {
        debugger;
        var blob = new Blob([document.getElementById('export').innerHTML], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
        });
        window.saveAs(blob, "Report.xls");
    },

how to do 
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8" <======this line
in pdf?

Mike Park

unread,
May 19, 2016, 10:51:57 AM5/19/16
to AngularJS
You need this first line of code:

var blob = new Blob([response], {type: 'application/pdf'});   
window.saveAs(blob, "Report.pdf");
Reply all
Reply to author
Forward
0 new messages