I want to convert some of my divs into PDF and I've tried jsPDF library but with no success.(我想将某些div转换为PDF,并且尝试了jsPDF库,但没有成功。)
It seems I can't understand what I need to import to make the library work.(看来我不明白我需要导入什么才能使库正常工作。) I've been through the examples and I still can't figure it out.(我已经看过这些示例,但仍然无法弄清楚。) I've tried the following:(我尝试了以下方法:)
<script type="text/javascript" src="js/jspdf.min.js"></script>
After jQuery and:(在jQuery之后:)
$("#html2pdf").on('click', function(){
var doc = new jsPDF();
doc.fromHTML($('body').get(0), 15, 15, {
'width': 170
});
console.log(doc);
});
for testing purposes but I receive:(出于测试目的,但我收到:)
"Cannot read property '#smdadminbar' of undefined"
where #smdadminbar
is the first div from the body.(其中#smdadminbar
是#smdadminbar
的第一个div。)
ask by Daniela costina Vaduva translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…