diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-04-04 13:37:01 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-04-04 13:37:01 +0200 |
commit | 2584a6d97090f8987f49ec3aa5abcbdf8b0d1b8e (patch) | |
tree | d9d91fc8fda429e32cbf39359e6e7b40cbd212b5 | |
parent | 3ea7e2ff59a9ec7e0fc549b00fbc5367f17a10f5 (diff) | |
download | perl-software-in-gnu-guix-2584a6d97090f8987f49ec3aa5abcbdf8b0d1b8e.tar perl-software-in-gnu-guix-2584a6d97090f8987f49ec3aa5abcbdf8b0d1b8e.tar.gz |
new cli and in-browser pdf printing compatible fix for #1804
-rw-r--r-- | css/print/pdf.css | 7 | ||||
-rw-r--r-- | js/reveal.js | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/css/print/pdf.css b/css/print/pdf.css index 8c3234c..20c646a 100644 --- a/css/print/pdf.css +++ b/css/print/pdf.css @@ -87,14 +87,14 @@ ul, ol, div, p { position: relative; overflow: hidden; z-index: 1; + + page-break-after: always; } .reveal .slides section { - page-break-after: always !important; - visibility: visible !important; display: block !important; - position: relative !important; + position: absolute !important; margin: 0 !important; padding: 0 !important; @@ -115,6 +115,7 @@ ul, ol, div, p { } .reveal section.stack { + position: relative !important; margin: 0 !important; padding: 0 !important; page-break-after: avoid !important; diff --git a/js/reveal.js b/js/reveal.js index e093cb8..dd015bc 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -617,7 +617,7 @@ slideHeight = slideSize.height; // Let the browser know what page size we want to print - injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0 0 -1px 0;}' ); + injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0px;}' ); // 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}' ); @@ -664,7 +664,15 @@ // so that no page ever flows onto another var page = document.createElement( 'div' ); page.className = 'pdf-page'; - page.style.height = ( pageHeight * numberOfPages ) + 'px'; + + // Set the total height of the PDF page container. + // + // This is offset by -1 to ensure that the page ends and + // breaks within the document/paper height. Ending exactly + // on the document height breaks in-browser printing, but + // works in CLI printing (phantomjs, wkpdf etc]). + page.style.height = ( ( pageHeight - 1 ) * numberOfPages ) + 'px'; + slide.parentNode.insertBefore( page, slide ); page.appendChild( slide ); |