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';
22
33import Worker from './worker.js' ;
44import './plugin/jspdf-plugin.js' ;
5+ import './plugin/pagebreaks.js' ;
56import './plugin/hyperlinks.js' ;
67
78/**
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() {
122122 this . prop . container . appendChild ( source ) ;
123123 this . prop . overlay . appendChild ( this . prop . container ) ;
124124 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 ) ;
134125 } ) ;
135126} ;
136127
You can’t perform that action at this time.
0 commit comments