I have a one page application in angular.
To create a PDF page from the HTML content I using jsPDF library.
In the index page there is a function that create PDF from this div:
(notice, this is a ng-view div)
The div
<div id="doPDF" ng-view></div>
But it is not successful.
the error
TypeError: undefined is not a function
The Js code
$scope.createPDF=function(){
var pdf = new jsPDF('p','pt','a4')
, source = $('#doPdf')[0]
, specialElementHandlers = {
'#aaa': function(element, renderer){
return true
}
}
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
pdf.save('Test.pdf');
},
margins
)
}
(In other div-s the DPF generator function work without problem.)
What can I do to generate PDF page from ng-view?
(I want one function that work from the index page and take the content from the ng-view.)