本文介绍了mPDF 未在新页面上添加页眉/页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
本质上,页眉和页脚仅显示在第一页和我手动分页后的第一页上.
Essentially, the headers and footers are only displaying on the first page and the first page after I manually break the page.
但是页眉和页脚不会显示在由于长 HTML 内容而自然延续的任何其他页面上.(即没有手册的地方)
But header and footer are NOT being displayed on any additional pages that are a natural continuation due to long HTML content. (i.e. where there is no manual )
<htmlpageheader name="header">Page Hader</htmlpageheader>
<htmlpagefooter name="footer"><p>Copyright <b>blablabla</b> 1999 - <?php echo date('Y') ?></p></htmlpagefooter>
页眉+页脚将显示在此页面上
Header+footer will display on this page
<sethtmlpageheader name="header" page="all" value="on" show-this-page="1" />
<sethtmlpagefooter name="footer" page="all" value="on" />
<p>(PDF cover)</p>
<h1>Report</h1>
页眉+页脚会显示在第一页,但不会显示在后续页面
Header+footer will display on the first page but not on subsequent pages
<pagebreak />
<sethtmlpageheader name="header" page="all" value="on" show-this-page="1" />
<sethtmlpagefooter name="footer" page="all" value="on" />
LONG HTML CONTENT
THAT EXCEEDS PAGE SIZE
推荐答案
你可以像这样添加@page:
You can add @page like this:
@page {
header: header_name;
footer: footer_name;
}
希望有用
这篇关于mPDF 未在新页面上添加页眉/页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!