2016-05-22 42 views
1

我想導出我的HTML代碼到PDF的一部分,爲了這個,我現在用的是下面的代碼:導出HTML + CSS來PDF使用Javascript

<script language = "JAVASCRIPT"> 
var doc = new jsPDF(); 
var specialElementHandlers = { 
    '#editor': function (element, renderer) { 
    return true; 
    } 
}; 
$('#download').click(function() { 
    doc.fromHTML($('#mytable').html(), 15, 15, { 
    'width': 170, 
     'elementHandlers': specialElementHandlers 
    }); 
    doc.save('sample-file.pdf'); 
}); 
</script> 

,但它不支持CSS ..如何我可以用它的風格導出它嗎?

+1

[用jspdf不導出CSS導出PDF]可能的副本(http://stackoverflow.com/questions/25946275/exporting-pdf-with-jspdf-not-rendering-css) –

回答

0

你想輸出什麼數據?

如果要導出HTML <table>,可以查看Shield UI Grid小工具提供的this export sample