We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ade6f97 commit 36041a9Copy full SHA for 36041a9
1 file changed
src/plugin/pagebreaks.js
@@ -1,14 +1,19 @@
1
import Worker from '../worker.js';
2
3
+// Add page-break functionality.
4
+
5
+// Refs to original functions.
6
var orig = {
7
toContainer: Worker.prototype.toContainer
8
};
9
10
Worker.prototype.toContainer = function toContainer() {
11
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
- // Enable page-breaks.
12
+ // Find all page-break elements and setup page height.
13
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
14
var pxPageHeight = this.prop.pageSize.inner.px.height;
15
16
+ // Set each page-break element to a block with the appropriate height.
17
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
18
el.style.display = 'block';
19
var clientRect = el.getBoundingClientRect();
0 commit comments