<div class="row">
<div class="col-md-3">
link 1
link 2
link 3
.
.
.
</div>
</div>
<div class="col-md-9">
<div ng-view></div>
</div>
当链接被点击子页面将在NG-查看装入>
<table class='table table-bordered'>
<tr>
<td>
this is my screen view
when user clicks a link in parent page
specific contentd loaded here
</td>
</tr>
</table>
<button type="button" class="btn btn-success btn-md" ng-click="myprint()" >
<span class="glyphicon glyphicon-print"></span> Print
</button>
<div id ="printsection">
<table style="width:80mm;">
<tr style="text-align: center;">
<td>this is my print view contents
send these contents
to print to printer
</td>
</tr>
</table>
</div>
以上子页有2个部分。屏幕视图和printsection。
我想要当用户点击打印按钮时,printsection内容发送到打印机。
我已经为介质打印定义了这些CSS规则。
print.css
body {
background-color: white;
color: black;
font-family: Times,"Times New Roman",Garamond, serif;
}
body * {
visibility: hidden;
}
#printsection * {
visibility: visible;
}
#printsection {
position: absolute;
left: 0;
top: 0;
}
问题是打印按钮,它隐藏所有内容,甚至是印刷部分的点击。
我在做什么错了?
请注意我使用的POS打印机80毫米宽度,dats我在printsection宽度= 80毫米。
怎么样myprint()函数? – felipsmartins
这应该涵盖你:http://stackoverflow.com/questions/22189544/print-a-div-using-javascript-in-angularjs-single-page-aplication –
我的打印程序是: \t $ scope。myprint = function(){ \t \t window.print(); \t} –