请检查链接 https://jsfiddle.net/dhaileytaha/1wmk9gsq/14/下载PDF格式不正确
<script>
/*Download option*/
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
doc.fromHTML($('#example').html(), 55, 55, {
'width': 170,
'elementHandlers': specialElementHandlers
});
document.getElementById("cmd").onclick = function() {
var pass1= "cool" ;
password=prompt('Please enter your password to Print this page!',' ');
if (password==pass1)
{
doc.save('target-file.pdf');
} else {
window.alert('Sorry! You are not Authorsised');
}
}
</script>
它是一个数据表。我能够以适当的格式打印它,但无法以与数据表格相同的格式下载。 请帮忙 我想要与pdf格式的DATATABLE相同的格式。
看看这篇文章:附上一个很好的工作示例。 http://stackoverflow.com/questions/16858954/how-to-properly-use-jspdf-library – lastboy