Freemarker, PDF, Header/Footer and page-breaks

时光怂恿深爱的人放手 提交于 2019-12-04 09:32:40

You can specify a header and a footer (including page numbers) with CSS. This will work if the tool used to transform your XHTML into the PDF byte array supports the paged media instructions.

In the CSS:

@page { 
    @top-center {content: element(header)}      /* Header */
    @bottom-center {content: element(footer)}   /* Enpied */
}
#header {position: running(header);}
#footer {position: running(footer);}
#pagenumber:before {content: counter(page);}
#pagecount:before {content: counter(pages);}

In the HTML:

<div id="header">YOUR HEADER HERE</div>
<div id="footer">Page <span id="pagenumber" /> / <span id="pagecount" /></div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!