CSS实现页面打印

CSS里有这样的一个标签:page-break-after,其属性值包括

always :始终在对象之后插入页分割符
avoid : 避免在对象后面插入页分割符
auto : 假如需要在对象之后插入页分割符
left : 在对象后面插入页分割符直到它到达一个空白的左页边
right :在对象后面插入页分割符直到它到达一个空白的右页边
null : 空值。IE5用来取消页分割符设置

使用过程中 遇到问题记录:

avoid row break for long tables
tr { page-break-inside: avoid !important; }

How to deal with page breaks when printing a large HTML table
    https://stackoverflow.com/questions/1763639/how-to-deal-with-page-breaks-when-printing-a-large-html-table

combine_pdf插件
How to embed font into PDF file with number_pages()?
    https://github.com/boazsegev/combine_pdf/issues/137

参考链接:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3195
                  https://stackoverflow.com/questions/58230151/table-row-is-getting-cut-while-using-wkhtmltopdf-node-module-converting-to-pdf

 

posted @ 2022-04-07 13:45  鞋带松了  阅读(79)  评论(0编辑  收藏  举报