bananaCute
bananaCute

Reputation: 433

Docraptor PDF: How to avoid displaying header in 2nd Page

Im generating PDFs using docraptor API and my pdfs can have multiple pages. I have set the header image for the pdf but it appears on all pages. I need the header in the first page only.

TIA

Upvotes: 0

Views: 771

Answers (2)

jamespaden
jamespaden

Reputation: 468

Lecstor's answer will definitely work in this case, but it's possible to have vary headers on different pages.

Full documentation is available on Prince (DocRaptor's PDF renderer) Named Pages section, but it should look roughly like this:

<style type="text/css">
@page has-header {
  @top {
    content: "This is header of text";
  }
}

.first-page {
  page: has-header; 
  /* all content within .first-page will use the above @page styling */
}
</style>

<div class="first-page">
  Put first page content here
</div>

<p>Rest of content will not have a header.</p>

That pattern can be repeated. Different named pages can have different headers, different margins, different landscape/portrait modes, sizes, etc..

Upvotes: 2

lecstor
lecstor

Reputation: 5707

Can you not just set it as normal content at the start of the document, not as a header which is repeated on each page?

Upvotes: 0

Related Questions