我想从webview.viewPrintformattor打印文档,但在UIwebview中分页符不起作用。请检查下面的css。
<style type="text/css">
@media print {
.page-break {
display: block;
page-break-after: always;
}
@page {
size: A4 portrait; /* can use also 'landscape' for orientation */
margin: 0.5in;
padding: 1em;
}
}
body {
font-family: calibri, arial, sans-serif;
font-size: 15px;
line-height: 1.5;
color: #000000;
}
h1, h2, h3 {
margin: 0;
padding: 0;
}
td {
vertical-align: top;
}
.ar {
direction: rtl;
text-align: justify;
}
.page-break {
display: block;
page-break-after: always;
}
@page {
size: A4 portrait; /* can use also 'landscape' for orientation */
margin: 0.5in;
padding: 1em;
}
</style>并使用下面的代码进行分页。
<div class="page-break"></div> 发布于 2016-12-24 01:01:29
http://www.w3schools.com/cssref/pr_print_pagebb.asp
定义和用法page- break -before属性设置分页符是否应出现在指定元素之前。
注意:不能在空的<div>或绝对定位的元素上使用此属性。
https://stackoverflow.com/questions/41305180
复制相似问题