【问题标题】:UIWebView not detecting page breaksUIWebView 未检测到分页符
【发布时间】:2016-12-25 16:35:05
【问题描述】:

我想从 webview.viewPrintformattor 打印文档,但分页符在 UI​​webview 中不起作用。请检查下面的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> 

【问题讨论】:

    标签: html ios css swift uiwebview


    【解决方案1】:

    http://www.w3schools.com/cssref/pr_print_pagebb.asp

    定义和用法 page-break-before 属性设置是否在指定元素之前出现分页符。

    注意:您不能在空的&lt;div&gt; 或绝对定位的元素上使用此属性。

    【讨论】:

    • 我正在使用 page-break-after,我添加 page-break-before 仅用于测试目的,但我已将其删除。但问题在于未检测到分页符的 UIwebview。有什么想法吗?
    • 不能在空 div 上使用 before 或 after。你有没有尝试过先做点什么?
    • 我只尝试了这两个(之前和之后)。请建议您是否知道如何分页。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-10
    • 2011-04-30
    • 2016-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多