Weasyprint: Is there a way to skip headers and/or footers on some pages?

Created on 5 Jul 2017  路  2Comments  路  Source: Kozea/WeasyPrint

I'm adding common headers and footers to all pages at the moment. If I don't want it to show up on some pages (the first page, for example) I'm generating a separate PDF for that and merging it with the rest of the document.

Is there a better way to skip headers and footers on some pages?

CSS question

All 2 comments

I guess this question is asked every few issues here ;)

how I did it was overriding the header for the first page..

@page聽{
  @top-center {
      background: url('logo.svg') no-repeat 0 0;
      background-size: 10%;
  }
}
@page :first {
  @top-center {
    background: none;
  }
}

This is not possible with :last page or any other than the first page. Therefore, it would be awesome to have distinct classes to target pages. But, I guess there is no "CSS standard" for that and thus it's not integrated in the core...

Some of these problems could be solved with named pages, see #57.

Was this page helpful?
0 / 5 - 0 ratings