- the right syntax is doc.fromHTML($('#target').get(0), ...
- jspdf can't render your css
Unable to read Css Styles and unable to load full HTML page in JSDF
Вопрос
I am using JSPDF library to load the HTML page into PDF, I tried with sample small HTML page, it worked well but in my Application its not displaying the complete HTML page and not loading css styles. Please help me where i went wrong.
$(document).ready(function(){
var specialElementHandlers = {
'#editor': function (element,renderer) {
return true;
}
};
$('#cmd').click(function () {
var doc = new jsPDF();
doc.getFontList();
doc.fromHTML($('#target').html(), 15, 15, {
'width': 170,
height: 30,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
});
Решение
Не связан с StackOverflow