[英]Force a new page using PdfBundle in Symfony2
我在Symfony2中使用PdfBundle (PHPPdf)並使用這樣的twig創建PDF:
<pdf>
<dynamic-page>
<placeholders>
<footer>
<div height="50px" width="100%">
<page-info font-size="9" font-type="helvetica" format="Page %s of %s" />
</div>
</footer>
</placeholders>
<div>
Some written text in the first page
</div>
<!-- Here I want to start always a second page -->
<div>
Some written text on the second page
</div>
</dynamic-page>
</pdf>
我希望第二個文本始終在新頁面上,但頁腳中的編號必須繼續。 當我開始一個新的動態頁面時,有一個新頁面,但網站的編號已經消失。
我找到了解決方案。 我誤解了信息和思想page-break
是一個屬性,但它是一個標簽。 所以我只能在我要打破頁面的位置設置<page-break />
。
<pdf>
<dynamic-page>
<placeholders>
<footer>
<div height="50px" width="100%">
<page-info font-size="9" font-type="helvetica" format="Page %s of %s" />
</div>
</footer>
</placeholders>
<div>
Some written text in the first page
</div>
<page-break />
<div>
Some written text on the second page
</div>
</dynamic-page>
</pdf>
<page-break />
是<dynamic-page>
的直接子<page-break />
也很重要。 它不能在div或table中。 必須關閉它們才能設置分頁符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.