Created
October 14, 2010 14:37
-
-
Save mping/626264 to your computer and use it in GitHub Desktop.
xhtmlrenderer (Flying Saucer) with css3 header/footer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="print.css" rel="stylesheet" type="text/css" media="screen,print"/> | |
... | |
<div style="-fs-page-sequence: start; page-break-before: always"> | |
<div style="position: running(current);"> | |
<div id="page-header" class="small"> | |
<span class="align-left">some stuff here</span> | |
<span class="align-right">some other stuff here</span> | |
<div class="line"> </div> | |
</div> | |
</div> | |
<div style="position: running(footer);"> | |
<div id="page-footer" class="small"> | |
<div class="line"> </div> | |
Page <span class="page" /> of <span class="pagecount" /> | |
</div> | |
</div> | |
content here | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.small {font-size: xx-small;} | |
.line{border-bottom: 1px solid black} | |
/** | |
* Specific Elements | |
*/ | |
#page-header { | |
display: inline; | |
} | |
#page-footer{ | |
text-align: right; | |
} | |
/** | |
* Flying Saucer custom stuff | |
* | |
* see https://xhtmlrenderer.dev.java.net/servlets/ReadMsg?listName=dev&msgNo=3707 | |
*/ | |
@page { | |
size: letter; /*letter landscape*/ | |
background: white; | |
@top-center { | |
content: element(current); | |
} | |
@bottom-right { | |
content: element(footer); | |
} | |
} | |
.page-start { -fs-page-sequence: start; page-break-before: always;} | |
table {-fs-table-paginate: paginate;page-break-inside: avoid;} | |
/* forces a page break */ | |
.break {page-break-after:always} | |
span.page:before { content: counter(page); } | |
span.pagecount:before { content: counter(pages); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment