From fcb6ea8385487194f257b9d556f9c98d0ec73301 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Thu, 28 Apr 2016 11:16:36 +0200 Subject: [PATCH] prevent pages from overflowing when printing to pdf --- js/reveal.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/reveal.js b/js/reveal.js index 89755046..bbe2ca4f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -597,6 +597,15 @@ 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 slide.style.left = left + 'px'; slide.style.top = top + 'px';