1
1
import Worker from '../worker.js' ;
2
2
import { objType , createElement } from '../utils.js' ;
3
3
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
+ */
5
25
6
26
// Refs to original functions.
7
27
var orig = {
@@ -10,7 +30,7 @@ var orig = {
10
30
11
31
// Add pagebreak default options to the Worker template.
12
32
Worker . template . opt . pagebreak = {
13
- mode : [ 'avoid-all' , ' css', 'legacy' ] , // All options: 'avoid-all', 'css', 'legacy'
33
+ mode : [ 'css' , 'legacy' ] ,
14
34
before : [ ] ,
15
35
after : [ ] ,
16
36
avoid : [ ]
0 commit comments