消息'pagebreakavoidchecked =“true”;'显示在新页面上

问题描述 投票:0回答:1

到目前为止,我们正在使用mPDF生成正确的PDF,结合PHP + CSS @page,其中包括“page-break-before”和“page-break-after”。我们使用“writeHTML”类编写每个块。但是,经过一些更改后,我们注意到mPDF生成并显示消息pagebreakavoidchecked="true";以及摘要后页面中断后的页面顶部,就在我们开始放置页眉和页脚时。

我们不知道为什么该消息只出现在该页面上。

请问,任何想法?你还需要其他信息吗?

谢谢

更新:我发现mPDF在“page-break-inside:avoid;”中存在一些问题。我这样使用它:

HTML:

<article class="bloque_anuncio">
    <header class="cabecera_anuncio"> 
        <p class="nivel1">Level 1</p>
        <p class="nivel2">Level 2</p>
        <p class="nivel3">Level 3</p>
        <p class="nivel4">Level 4</p>
    </header>
    <div class="contenido_anuncio">
        a lot of text (at least a complete page, but usually several pages)
    </div>
</article>

有几篇文章,但我想在内容中保留标题,所以我在样式表中使用:.cabecera_anuncio {page-break-inside:avoid; }

并且它应该工作,但是,mPDF在第一页的开头插入所提到的消息(并且只在那里):This is a capture of the text inserted by mPDF in the first page (not of the document, but the first time it should use the style如果我删除样式,消息消失,但我需要避免在这一点上的分页!

mpdf
1个回答
0
投票

我注意到问题只与<p>标签有关。尝试用<div>标签替换

© www.soinside.com 2019 - 2024. All rights reserved.