0
Iam試圖從html轉換爲pdf轉換。因此,我在我的項目中使用jspdf插件jsPdf不能與css工作
<script type="text/javascript" src="../../../../resources/jspdf/html2canvas.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.addimage.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.cell.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.from_html.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.ie_below_9_shim.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.javascript.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.sillysvgrenderer.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.plugin.standard_fonts_metrics.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jspdf.PLUGINTEMPLATE.js"></script>
<script type="text/javascript" src="../../../../resources/jspdf/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var specialElementHandlers = {
'#editor': function (element,renderer) {
return true;
}
};
$('#generatePdf').click(function() {
var doc = new jsPDF();
var source = $('#cisForm').html();
var specialElementHandlers = {
'#bypassme': function (element, renderer) {
return true;
}
};
/*doc.fromHTML(source, 0.5, 0.5, {
'width': 75,'elementHandlers': specialElementHandlers
});
*/
doc.addHTML($('body'), function() {
doc.save('Test.pdf');
});
doc.output("dataurlnewwindow");
});
});
</script>
在我用doc.fromHTML()嘗試之前。
由於css不受支持,我已經從canvas js更改爲doc.addHTML()。
但我現在得到錯誤的
Uncaught TypeError: doc.addHTML is not a function
這裏有什麼問題。它將與CSS文件的工作