From 3adaed2a1ee1bb3306cb30aa86b90819d1c03af6 Mon Sep 17 00:00:00 2001
From: Hakim El Hattab <hakim.elhattab@gmail.com>
Date: Sat, 26 Apr 2014 08:26:20 +0200
Subject: [PATCH] allow tall slides to spread over pages in pdf export

---
 js/reveal.js | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/js/reveal.js b/js/reveal.js
index 3ca9d6f..00c3aa0 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -430,22 +430,30 @@ var Reveal = (function(){
 			// Vertical stacks are not centred since their section
 			// children will be
 			if( slide.classList.contains( 'stack' ) === false ) {
+				// Center the slide inside of the page, giving the slide some margin
 				var left = ( pageWidth - slideWidth ) / 2,
 					top = ( pageHeight - slideHeight ) / 2;
 
-				if( config.center || slide.classList.contains( 'center' ) ) {
-					top = Math.max( ( pageHeight - getAbsoluteHeight( slide ) ) / 2, 0 );
+				var contentHeight = getAbsoluteHeight( slide );
+				var numberOfPages = Math.ceil( contentHeight / slideHeight );
+
+				// Top align when we're taller than a single page
+				if( numberOfPages > 1 ) {
+					top = 0;
+				}
+				// Center the slide vertically
+				else if( config.center || slide.classList.contains( 'center' ) ) {
+					top = Math.max( ( pageHeight - contentHeight ) / 2, 0 );
 				}
 
+				// Position the slide inside of the page
 				slide.style.left = left + 'px';
 				slide.style.top = top + 'px';
 				slide.style.width = slideWidth + 'px';
-				slide.style.height = slideHeight + 'px';
-
-				if( slide.scrollHeight > slideHeight ) {
-					slide.style.overflow = 'hidden';
-				}
+				slide.style.height = ( slideHeight * numberOfPages ) + 'px';
 
+				// TODO Backgrounds need to be multiplied when the slide
+				// stretches over multiple pages
 				var background = slide.querySelector( '.slide-background' );
 				if( background ) {
 					background.style.width = pageWidth + 'px';
-- 
GitLab