dompdf:如何在每个页面上添加标题除外? [英] dompdf: How to add header on every page except first?

查看:143
本文介绍了dompdf:如何在每个页面上添加标题除外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用dompdf来生成PDF。我已经从dompdf网站上获取了代码来为PDF添加一个Header,并且它正在工作,但是我希望将标题放在除第一个页面之外的每个页面上。任何建议?

解决方案

您可以通过在第一页中出现的元素后插入页眉和页脚元素来完成此操作。 / p>

例如:



 <风格> 
.flyleaf {
page-break-after:always;
}

.header,.footer {
position:fixed;
}

.header {
top:0;
}

.footer {
bottom:0;
}
< / style>

< div class =flyleaf>
一些大标题
< / div>

< div class =header>
我的标题
< / div>

< div class =footer>
我的footer blah,blah
< / div>

< p>内容< / p>

编辑:添加了样式标签


I'm using dompdf to generate a PDF. I've grabbed the code from the dompdf website to add a Header to the pdf and it's working, but I would like to put the header on every page except for the first. Any suggestions?

解决方案

You can do this by inserting the header and footer elements after the elements that appear in the first page.

For example :

<style>
  .flyleaf {
    page-break-after: always;
  }

  .header, .footer {
    position: fixed;
  }

  .header {
    top: 0;
  }

  .footer {
    bottom: 0;
  }
</style>

<div class="flyleaf">
  Some big title
</div>

<div class="header">
  my header
</div>

<div class="footer">
  my footer blah, blah
</div>

<p>The content</p>

Edit: added the style tag

这篇关于dompdf:如何在每个页面上添加标题除外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆