Html部分:
<div id="test">
<style type="text/css">
.tt tr td{
font-size: 12px;
}
</style>
<h3 class="text-center">标题</h3>
<table class="table table-bordered table_detail" style="margin-top: 30px;">
<tbody class="tt">
</tbody>
</table>
</div>
<import file="lib.js.jquery#jqprint" />
<script type="text/javascript">
$(document).on("click","#print",function(){ //控制按钮。
$("#test").show();
$("#test").jqprint();
$("#test").hide();
});
</script>
如果要实现手动分页:在要分页的结尾处加上<div style="page-break-after:always;"></div>
<div id="test">
<style type="text/css">
.tt tr td{
font-size: 12px;
}
</style>
<h3 class="text-center">标题</h3>
<table class="table table-bordered table_detail" style="margin-top: 30px;">
<tbody class="tt">
</tbody>
</table>
</div>
<button type="button" class="btn btn-info btn-sm" id='print'><i class="fa fa-print"></i> 打印</button>
<import file="lib.js.jquery#jqprint" />
<script type="text/javascript">
$(document).on("click","#print",function(){ //控制按钮。
$("#test").show();
$("#test").jqprint();
$("#test").hide();
});
</script>
如果要实现手动分页:在要分页的结尾处加上<div style="page-break-after:always;"></div>