Skip to content

Commit

Permalink
fix empty pages in pdf exports (closes #1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jan 24, 2017
1 parent 568c751 commit 286b69b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion css/print/pdf.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
9 changes: 7 additions & 2 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 );

Expand Down

0 comments on commit 286b69b

Please sign in to comment.