Skip to content

Commit 953d302

Browse files
committed
adjust pdf margins instead of heights to fix hakimel#1804
1 parent d9dcff1 commit 953d302

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

css/print/pdf.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ul, ol, div, p {
9090
}
9191

9292
.reveal .slides section {
93-
page-break-after: auto !important;
93+
page-break-after: always !important;
9494

9595
visibility: visible !important;
9696
display: block !important;

js/reveal.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605
slideHeight = slideSize.height;
606606

607607
// Let the browser know what page size we want to print
608-
injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0;}' );
608+
injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0 0 -1px 0;}' );
609609

610610
// Limit the size of certain elements to the dimensions of the slide
611611
injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' );
@@ -652,12 +652,7 @@
652652
// so that no page ever flows onto another
653653
var page = document.createElement( 'div' );
654654
page.className = 'pdf-page';
655-
656-
// Reduce total height by 1px so that the page ends before
657-
// the page, otherwise the page's 'page-break-after' will
658-
// land on the wrong page
659-
page.style.height = ( ( pageHeight - 1 ) * numberOfPages ) + 'px';
660-
655+
page.style.height = ( pageHeight * numberOfPages ) + 'px';
661656
slide.parentNode.insertBefore( page, slide );
662657
page.appendChild( slide );
663658

0 commit comments

Comments
 (0)