Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

pdf - dompdf: How to add header on every page except first?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...