我想用angulaJS打印一个给定的页面,所以做了这个简单的解决方案:
<div class="modal fade" id="extrait" aria-hidden="true" data-backdrop="false">
<table class="table table-hover table-bordered" id="tab1">
<thead>
<tr class="row-name" >
<th >Banque</th>
<th>N. Cheque</th>
<th>Montant</th>
</tr>
</thead>
<tbody>
<tr class="row-content" ng-repeat="cl in extraits">
<td>{{cl.nomBanque}}</td>
<td>{{cl.numCheque}}</td>
<td>{{cl.montant}}</td>
</tr>
</tbody>
</table>
<div class="btn-group" role="group">
<button id="btnPrint" class="btn btn-info btn-block" ng-click="print()">Print</button>
</div>
</div>
<script>
$scope.print=function(){
$window.print();
};
</script>
它有效,但是当我有一个很长的列表要打印时,它只打印一页,然后出现滚动条。我想打印第1页第1页....请问您有什么建议吗?感谢。
答案 0 :(得分:1)
您可以使用css3媒体查询进行打印,如下所示:
@media print {
body, html, #wrapper {
width: 100%;
}
}
或者您可以使用单独的css文件并使用百分比值,如下所示:
<link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>
print.css :
body, html, #wrapper {
width: 100%;
}