Add borders to each printed page with CSS?

送分小仙女□ 提交于 2019-12-23 09:34:25

问题


Is it possible in CSS or js to emulate the following format in printed media (eg showing borders for each page, with a page number and some text in the corner, with the content nicely split - and not chopped in half)?

I have been using page-break-after to split the content up, but havn't found a way to add this kind of border/page number to each page. This only needs to work in WebKit.

For further information, the reason I am doing this is I am printing HTML documents to PDF using wkhtml.


回答1:


Trying using the print media type.

@media print {
...
}

Information and tutorial on leveraging the print media type.

Tutorial on CSS page-breaking for print



来源:https://stackoverflow.com/questions/22639368/add-borders-to-each-printed-page-with-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!