File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import 'es6-promise/auto';
2
2
3
3
import Worker from './worker.js' ;
4
4
import './plugin/jspdf-plugin.js' ;
5
+ import './plugin/pagebreaks.js' ;
5
6
import './plugin/hyperlinks.js' ;
6
7
7
8
/**
Original file line number Diff line number Diff line change
1
+ import Worker from '../worker.js' ;
2
+
3
+ var orig = {
4
+ toContainer : Worker . prototype . toContainer
5
+ } ;
6
+
7
+ Worker . prototype . toContainer = function toContainer ( ) {
8
+ return orig . toContainer . call ( this ) . then ( function toContainer_pagebreak ( ) {
9
+ // Enable page-breaks.
10
+ var pageBreaks = source . querySelectorAll ( '.html2pdf__page-break' ) ;
11
+ var pxPageHeight = this . prop . pageSize . inner . px . height ;
12
+ Array . prototype . forEach . call ( pageBreaks , function pageBreak_loop ( el ) {
13
+ el . style . display = 'block' ;
14
+ var clientRect = el . getBoundingClientRect ( ) ;
15
+ el . style . height = pxPageHeight - ( clientRect . top % pxPageHeight ) + 'px' ;
16
+ } , this ) ;
17
+ } ) ;
18
+ } ;
Original file line number Diff line number Diff line change @@ -122,15 +122,6 @@ Worker.prototype.toContainer = function toContainer() {
122
122
this . prop . container . appendChild ( source ) ;
123
123
this . prop . overlay . appendChild ( this . prop . container ) ;
124
124
document . body . appendChild ( this . prop . overlay ) ;
125
-
126
- // Enable page-breaks.
127
- var pageBreaks = source . querySelectorAll ( '.html2pdf__page-break' ) ;
128
- var pxPageHeight = this . prop . pageSize . inner . px . height ;
129
- Array . prototype . forEach . call ( pageBreaks , function pageBreak_loop ( el ) {
130
- el . style . display = 'block' ;
131
- var clientRect = el . getBoundingClientRect ( ) ;
132
- el . style . height = pxPageHeight - ( clientRect . top % pxPageHeight ) + 'px' ;
133
- } , this ) ;
134
125
} ) ;
135
126
} ;
136
127
You can’t perform that action at this time.
0 commit comments