Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/plugin/pagebreaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Worker.template.opt.pagebreak = {
mode: ['css', 'legacy'],
before: [],
after: [],
avoid: []
avoid: [],
elementType: 'div', //default element to create
className: '' //by default no class
};

Worker.prototype.toContainer = function toContainer() {
Expand Down Expand Up @@ -114,10 +116,10 @@ Worker.prototype.toContainer = function toContainer() {

// Before: Create a padding div to push the element to the next page.
if (rules.before) {
var pad = createElement('div', {style: {
var pad = createElement(self.opt.pagebreak.elementType, {style: { //allow for creating any type of element e.g. 'tr' (this is useful for tables and other cases where a 'div' will ruin the styling and cannot be handled by simply using the div selector as thats too broad.
display: 'block',
height: pxPageHeight - (clientRect.top % pxPageHeight) + 'px'
}});
}, className: self.opt.pagebreak.className}); //allow control of styling of added sections
el.parentNode.insertBefore(pad, el);
}

Expand Down