javacssjsoupopenhtmltopdf

Different headers when printing


I need to export multiple HTML files into a single PDF one. I'm using @page rules to apply a header.

I need to :

What I tried :

I know about @page:first and @page:last but would like to be able to apply different styles for every page in between.


Solution

  • I found a solution !

    You can specify some content to be on a named page :

    @page A { @top-left { content:"..." } }

    div-A { page: A; }

    <div-A> Content that has a specific header </div-A>

    Don't forget to apply some rules like "page-break-after: always"