adjust pdf margins instead of heights to fix #1804

This commit is contained in:
Hakim El Hattab 2017-01-25 10:43:26 +01:00
parent 934c2e9730
commit 84202fa072
2 changed files with 3 additions and 8 deletions

View file

@ -90,7 +90,7 @@ ul, ol, div, p {
} }
.reveal .slides section { .reveal .slides section {
page-break-after: auto !important; page-break-after: always !important;
visibility: visible !important; visibility: visible !important;
display: block !important; display: block !important;

View file

@ -605,7 +605,7 @@
slideHeight = slideSize.height; slideHeight = slideSize.height;
// Let the browser know what page size we want to print // 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 // 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}' ); 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 // 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 - 1 ) * numberOfPages ) + 'px';
slide.parentNode.insertBefore( page, slide ); slide.parentNode.insertBefore( page, slide );
page.appendChild( slide ); page.appendChild( slide );