Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分页打印处理 #8

Open
itstrive opened this issue Aug 22, 2018 · 0 comments
Open

分页打印处理 #8

itstrive opened this issue Aug 22, 2018 · 0 comments
Labels
record Record Skill

Comments

@itstrive
Copy link
Owner

itstrive commented Aug 22, 2018

有时候打印需要做分页处理。

可以使用css中的 page-break-after 或者 page-break-before 处理。

通用处理可以

<div style="page-break-after: always;"></div>

放到想分页的地方即可,当然您也可以定义一个class,扔到想分页的元素身上。

可以参考:


另外打印 推荐大家一个小库 PrintJs

github地址: https://github.com/crabbly/Print.js

简单使用:

        const style = `@media print{h3{color:red}}`
        printJS({
            printable:'需要打印DOM节点的id',
            type:'html',
            documentTitle:'打印的页眉',
            style: style,
            scanStyles: false
        });
@itstrive itstrive added the record Record Skill label Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
record Record Skill
Projects
None yet
Development

No branches or pull requests

1 participant