prevent pages from overflowing when printing to pdf

edit
Hakim El Hattab 2016-04-28 11:16:36 +02:00
parent 66c4e6a77f
commit fcb6ea8385
1 changed files with 9 additions and 0 deletions

View File

@ -597,6 +597,15 @@
top = Math.max( ( pageHeight - contentHeight ) / 2, 0 ); top = Math.max( ( pageHeight - contentHeight ) / 2, 0 );
} }
// Wrap the slide in a page element and hide its overflow
// so that no page ever flows onto another
var page = document.createElement( 'div' );
page.className = 'page';
page.style.overflow = 'hidden';
page.style.height = ( pageHeight * numberOfPages ) + 'px';
slide.parentNode.insertBefore( page, slide );
page.appendChild( slide );
// Position the slide inside of the page // Position the slide inside of the page
slide.style.left = left + 'px'; slide.style.left = left + 'px';
slide.style.top = top + 'px'; slide.style.top = top + 'px';