From 286b69b61f64bf47dd3ea710175aeb4de8288d9f Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 24 Jan 2017 14:48:36 +0100 Subject: fix empty pages in pdf exports (closes #1804) --- js/reveal.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index c1c4eca..8b00420 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -598,7 +598,7 @@ // Dimensions of the PDF pages var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), - pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) ); + pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) ); // Dimensions of slides within the pages var slideWidth = slideSize.width, @@ -652,7 +652,12 @@ // so that no page ever flows onto another var page = document.createElement( 'div' ); page.className = 'pdf-page'; - page.style.height = ( pageHeight * numberOfPages ) + 'px'; + + // Reduce total height by 1px so that the page ends before + // the page, otherwise the page's 'page-break-after' will + // land on the wrong page + page.style.height = ( ( pageHeight * numberOfPages ) - 1 ) + 'px'; + slide.parentNode.insertBefore( page, slide ); page.appendChild( slide ); -- cgit v1.2.3 From d9dcff1503cb4e8043a2b434de3cc635914164cb Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 24 Jan 2017 15:27:27 +0100 Subject: additional fix for empty pages in pdf exports #1804 --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index 8b00420..95a4883 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -656,7 +656,7 @@ // Reduce total height by 1px so that the page ends before // the page, otherwise the page's 'page-break-after' will // land on the wrong page - page.style.height = ( ( pageHeight * numberOfPages ) - 1 ) + 'px'; + page.style.height = ( ( pageHeight - 1 ) * numberOfPages ) + 'px'; slide.parentNode.insertBefore( page, slide ); page.appendChild( slide ); -- cgit v1.2.3 From 953d302f8b3c1a5dfc430f2e34b67a81bc35c9d2 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 25 Jan 2017 10:43:26 +0100 Subject: adjust pdf margins instead of heights to fix #1804 --- js/reveal.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index 95a4883..46ca50c 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -605,7 +605,7 @@ slideHeight = slideSize.height; // Let the browser know what page size we want to print - injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0;}' ); + injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0 0 -1px 0;}' ); // Limit the size of certain elements to the dimensions of the slide injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' ); @@ -652,12 +652,7 @@ // so that no page ever flows onto another var page = document.createElement( 'div' ); page.className = 'pdf-page'; - - // Reduce total height by 1px so that the page ends before - // the page, otherwise the page's 'page-break-after' will - // land on the wrong page - page.style.height = ( ( pageHeight - 1 ) * numberOfPages ) + 'px'; - + page.style.height = ( pageHeight * numberOfPages ) + 'px'; slide.parentNode.insertBefore( page, slide ); page.appendChild( slide ); -- cgit v1.2.3 From 9f8e4d5742df486cce577f6e0dbae666aabc4eb1 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 25 Jan 2017 10:51:25 +0100 Subject: 3.4.1 --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index 46ca50c..9251dc0 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -26,7 +26,7 @@ var Reveal; // The reveal.js version - var VERSION = '3.4.0'; + var VERSION = '3.4.1'; var SLIDES_SELECTOR = '.slides section', HORIZONTAL_SLIDES_SELECTOR = '.slides>section', -- cgit v1.2.3