11import Worker from '../worker.js' ;
22import { 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.
727var orig = {
@@ -10,7 +30,7 @@ var orig = {
1030
1131// Add pagebreak default options to the Worker template.
1232Worker . 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