Javascript 使用jsPDF将HTML表格导出为PDF格式
我正在使用jspdf将表格从html导出为PDF,但是我的表格看起来很混乱: 这是我的html表格: 最后,这是我的代码:Javascript 使用jsPDF将HTML表格导出为PDF格式,javascript,php,html,export,jspdf,Javascript,Php,Html,Export,Jspdf,我正在使用jspdf将表格从html导出为PDF,但是我的表格看起来很混乱: 这是我的html表格: 最后,这是我的代码: function demoFromHTML() { var pdf = new jsPDF('p', 'pt', 'letter'); source = jQuery('#customers')[0]; specialElementHandlers = { // element with id of "bypass" - jQu
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
source = jQuery('#customers')[0];
specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer) {
// true = "handled elsewhere, bypass text extraction"
return true
}
};
margins = {
top: 30,
bottom: 60,
left: 60,
width: 700
};
pdf.fromHTML(
source,
margins.left,
margins.top, {
'width': margins.width,
'elementHandlers': specialElementHandlers
},
function(dispose) {
pdf.save('Test.pdf');
}
, margins);
}
我真的很困惑为什么它不能正常工作,我已经尝试了很多东西,但似乎这只能通过jspdf文档来解决,而在导出表时,jspdf文档几乎是不存在的,我真的很绝望,任何帮助都是感谢的
谢谢:)您对HTML是否有效有多大把握?