how to convert html <div> to pdf
how to convert html <div> to pdf
转换为 PDF。
<div id="content">
<h3>Hello</h3>
<table id = "tblHeader" >
<tbody>
<tr>
<td width="10%">name</td>
<td width="15%">id</td>
<td width="27%">Patient Name </td>
<td width="8%">Age</td>
</tr>
</tbody>
</table>
</div>
<button id="cmd">generate PDF</button>
这张表我需要转换为pdf。
我尝试使用jspdf和下面提到的功能。
$(function () {
$('#cmd').click(function () {
var pdf = new jsPDF('p', 'pt', 'letter'),
source = $('#tblHeader')[0],
margins = {
top: 40,
bottom: 40,
left: 40,
right: 40,
width: 522
};
pdf.fromHTML(
source,
margins.left,
margins.top,
{
'width': margins.width
},
function (dispose) {
pdf.save('Test.pdf');
},
margins
);
});
});
它生成了以列数据作为行的pdf。请帮助我。
包含以下脚本文件
<script src="/Scripts/plugin/jsPdf/jspdf.debug.js"></script>
相关文章:
- 添加文字和评论功能更新Div
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- 点击后隐藏潜水?(但如果Div是一面旗帜呢?)
- 使用JavaScript动态插入DIV的成本有多高
- DIV并排,位置不正确
- Div根据<选择>菜单
- Href:当前DIV中的目标ID
- how to convert html <div> to pdf
- Javascript to hide a DIV
- Rails 3.2 Coffeescript to Refresh Div using Ajax - 重新加载整个页面
- html <div> doesn't seem to get recognised
- how to make a <div> appear in slow motion
- DIV AREA类似于下拉菜单(display:none to display:block)
- scrollLeft: to END OF MAIN DIV not offset().left
- HREF to DIV value
- How to I .append() user input inside a <div> tag?
- Div to image with jQuery/JavaScript
- Div to img HTML2Canvas
- CSS Positioning relative to corner of Div
- Don't overwrite in <div> but add to <div>