Skip to content

Commit 13f1011

Browse files
committed
Add doc and remove avoid-all from default
1 parent 79b4549 commit 13f1011

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/plugin/pagebreaks.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
import Worker from '../worker.js';
22
import { objType, createElement } from '../utils.js';
33

4-
// Add page-break functionality.
4+
/* Pagebreak plugin:
5+
6+
Adds page-break functionality to the html2pdf library. Page-breaks can be
7+
enabled by CSS styles, set on individual elements using selectors, or
8+
avoided from breaking inside all elements.
9+
10+
Options on the `opt.pagebreak` object:
11+
12+
mode: String or array of strings: 'avoid-all', 'css', and/or 'legacy'
13+
Default: ['css', 'legacy']
14+
15+
before: String or array of CSS selectors for which to add page-breaks
16+
before each element. Can be a specific element with an ID
17+
('#myID'), all elements of a type (e.g. 'img'), all of a class
18+
('.myClass'), or even '*' to match every element.
19+
20+
after: Like 'before', but adds a page-break immediately after the element.
21+
22+
avoid: Like 'before', but avoids page-breaks on these elements. You can
23+
enable this feature on every element using the 'avoid-all' mode.
24+
*/
525

626
// Refs to original functions.
727
var orig = {
@@ -10,7 +30,7 @@ var orig = {
1030

1131
// Add pagebreak default options to the Worker template.
1232
Worker.template.opt.pagebreak = {
13-
mode: ['avoid-all', 'css', 'legacy'], // All options: 'avoid-all', 'css', 'legacy'
33+
mode: ['css', 'legacy'],
1434
before: [],
1535
after: [],
1636
avoid: []

0 commit comments

Comments
 (0)