fix empty pages in pdf exports (closes #1804)

master
Hakim El Hattab 2017-01-24 14:48:36 +01:00
parent 568c7516f7
commit 286b69b61f
2 changed files with 9 additions and 3 deletions

View File

@ -90,7 +90,7 @@ ul, ol, div, p {
} }
.reveal .slides section { .reveal .slides section {
page-break-after: always !important; page-break-after: auto !important;
visibility: visible !important; visibility: visible !important;
display: block !important; display: block !important;
@ -139,6 +139,7 @@ ul, ol, div, p {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: auto !important;
} }
/* Display slide speaker notes when 'showNotes' is enabled */ /* Display slide speaker notes when 'showNotes' is enabled */

View File

@ -598,7 +598,7 @@
// Dimensions of the PDF pages // Dimensions of the PDF pages
var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), 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 // Dimensions of slides within the pages
var slideWidth = slideSize.width, var slideWidth = slideSize.width,
@ -652,7 +652,12 @@
// so that no page ever flows onto another // so that no page ever flows onto another
var page = document.createElement( 'div' ); var page = document.createElement( 'div' );
page.className = 'pdf-page'; 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 ); slide.parentNode.insertBefore( page, slide );
page.appendChild( slide ); page.appendChild( slide );