From 286b69b61f64bf47dd3ea710175aeb4de8288d9f Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 24 Jan 2017 14:48:36 +0100 Subject: [PATCH 1/4] fix empty pages in pdf exports (closes #1804) --- css/print/pdf.css | 3 ++- js/reveal.js | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/css/print/pdf.css b/css/print/pdf.css index 4bfcddc..8c82f73 100644 --- a/css/print/pdf.css +++ b/css/print/pdf.css @@ -90,7 +90,7 @@ ul, ol, div, p { } .reveal .slides section { - page-break-after: always !important; + page-break-after: auto !important; visibility: visible !important; display: block !important; @@ -139,6 +139,7 @@ ul, ol, div, p { left: 0; width: 100%; height: 100%; + z-index: auto !important; } /* Display slide speaker notes when 'showNotes' is enabled */ 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 ); From d9dcff1503cb4e8043a2b434de3cc635914164cb Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 24 Jan 2017 15:27:27 +0100 Subject: [PATCH 2/4] additional fix for empty pages in pdf exports #1804 --- css/print/pdf.css | 2 +- js/reveal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/css/print/pdf.css b/css/print/pdf.css index 8c82f73..d3bf951 100644 --- a/css/print/pdf.css +++ b/css/print/pdf.css @@ -132,7 +132,7 @@ ul, ol, div, p { } /* Slide backgrounds are placed inside of their slide when exporting to PDF */ -.reveal section .slide-background { +.reveal .slide-background { display: block !important; position: absolute; top: 0; 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 ); From 953d302f8b3c1a5dfc430f2e34b67a81bc35c9d2 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 25 Jan 2017 10:43:26 +0100 Subject: [PATCH 3/4] adjust pdf margins instead of heights to fix #1804 --- css/print/pdf.css | 2 +- js/reveal.js | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/css/print/pdf.css b/css/print/pdf.css index d3bf951..8c3234c 100644 --- a/css/print/pdf.css +++ b/css/print/pdf.css @@ -90,7 +90,7 @@ ul, ol, div, p { } .reveal .slides section { - page-break-after: auto !important; + page-break-after: always !important; visibility: visible !important; display: block !important; 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 ); From 9f8e4d5742df486cce577f6e0dbae666aabc4eb1 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 25 Jan 2017 10:51:25 +0100 Subject: [PATCH 4/4] 3.4.1 --- bower.json | 2 +- js/reveal.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index b3bc42d..c7c312d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "reveal.js", - "version": "3.4.0", + "version": "3.4.1", "main": [ "js/reveal.js", "css/reveal.css" 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', diff --git a/package.json b/package.json index 1899fd9..1f866ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reveal.js", - "version": "3.4.0", + "version": "3.4.1", "description": "The HTML Presentation Framework", "homepage": "http://lab.hakim.se/reveal-js", "subdomain": "revealjs",