aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2018-03-20 10:09:47 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2018-03-20 10:09:47 +0100
commitea57e697a12f0a87d2a54d4620b759f33f77dd1c (patch)
tree40702d6da9d49ad655f517adb822ac493fd1d646
parentf76b4fda93a8d8770390d4e89b68f8ac27e32dc9 (diff)
downloadperl-software-in-gnu-guix-ea57e697a12f0a87d2a54d4620b759f33f77dd1c.tar
perl-software-in-gnu-guix-ea57e697a12f0a87d2a54d4620b759f33f77dd1c.tar.gz
Revert "remove pdf height offset"
This reverts commit f76b4fda93a8d8770390d4e89b68f8ac27e32dc9.
-rw-r--r--js/reveal.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/js/reveal.js b/js/reveal.js
index dcd09c7..626ce7a 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -196,6 +196,13 @@
// to PDF, unlimited by default
pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
+ // Offset used to reduce the height of content within exported PDF pages.
+ // This exists to account for environment differences based on how you
+ // print to PDF. CLI printing options, like phantomjs and wkpdf, can end
+ // on precisely the total height of the document whereas in-browser
+ // printing has to end one pixel before.
+ pdfPageHeightOffset: -1,
+
// Number of slides away from the current that are visible
viewDistance: 3,
@@ -661,8 +668,8 @@
var slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight );
// Dimensions of the PDF pages
- var pageWidth = Math.ceil( slideSize.width * ( 1 + config.margin ) ),
- pageHeight = Math.ceil( slideSize.height * ( 1 + config.margin ) );
+ var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ),
+ pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) );
// Dimensions of slides within the pages
var slideWidth = slideSize.width,
@@ -719,7 +726,7 @@
// so that no page ever flows onto another
var page = document.createElement( 'div' );
page.className = 'pdf-page';
- page.style.height = ( pageHeight * numberOfPages ) + 'px';
+ page.style.height = ( ( pageHeight + config.pdfPageHeightOffset ) * numberOfPages ) + 'px';
slide.parentNode.insertBefore( page, slide );
page.appendChild( slide );