Skip to content

Commit

Permalink
adjust pdf margins instead of heights to fix hakimel#1804
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel authored and Tobias committed Feb 22, 2018
1 parent d59517c commit 102b333
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 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: auto !important;
page-break-after: always !important;

visibility: visible !important;
display: block !important;
Expand Down
9 changes: 2 additions & 7 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}' );
Expand Down Expand Up @@ -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 );

Expand Down

0 comments on commit 102b333

Please sign in to comment.