Group pdf setup reads and writes
This commit is contained in:
parent
33c4c1c5d2
commit
10f02ece99
@ -18,18 +18,24 @@ export default class Print {
|
|||||||
*/
|
*/
|
||||||
async setupPDF() {
|
async setupPDF() {
|
||||||
|
|
||||||
let config = this.Reveal.getConfig();
|
const config = this.Reveal.getConfig();
|
||||||
|
const slides = queryAll( this.Reveal.getRevealElement(), SLIDES_SELECTOR )
|
||||||
|
|
||||||
let slideSize = this.Reveal.getComputedSlideSize( window.innerWidth, window.innerHeight );
|
// Compute slide numbers now, before we start duplicating slides
|
||||||
|
const doingSlideNumbers = config.slideNumber && /all|print/i.test( config.showSlideNumber );
|
||||||
|
|
||||||
|
const slideSize = this.Reveal.getComputedSlideSize( window.innerWidth, window.innerHeight );
|
||||||
|
|
||||||
// Dimensions of the PDF pages
|
// Dimensions of the PDF pages
|
||||||
let pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ),
|
const pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ),
|
||||||
pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) );
|
pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) );
|
||||||
|
|
||||||
// Dimensions of slides within the pages
|
// Dimensions of slides within the pages
|
||||||
let slideWidth = slideSize.width,
|
const slideWidth = slideSize.width,
|
||||||
slideHeight = slideSize.height;
|
slideHeight = slideSize.height;
|
||||||
|
|
||||||
|
await new Promise(requestAnimationFrame);
|
||||||
|
|
||||||
// Let the browser know what page size we want to print
|
// Let the browser know what page size we want to print
|
||||||
createStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0px;}' );
|
createStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0px;}' );
|
||||||
|
|
||||||
@ -41,13 +47,9 @@ export default class Print {
|
|||||||
document.body.style.height = pageHeight + 'px';
|
document.body.style.height = pageHeight + 'px';
|
||||||
|
|
||||||
// Make sure stretch elements fit on slide
|
// Make sure stretch elements fit on slide
|
||||||
|
await new Promise(requestAnimationFrame);
|
||||||
this.Reveal.layoutSlideContents( slideWidth, slideHeight );
|
this.Reveal.layoutSlideContents( slideWidth, slideHeight );
|
||||||
|
|
||||||
const slides = queryAll( this.Reveal.getRevealElement(), SLIDES_SELECTOR )
|
|
||||||
|
|
||||||
// Compute slide numbers now, before we start duplicating slides
|
|
||||||
let doingSlideNumbers = config.slideNumber && /all|print/i.test( config.showSlideNumber );
|
|
||||||
|
|
||||||
// Batch scrollHeight access to prevent layout thrashing
|
// Batch scrollHeight access to prevent layout thrashing
|
||||||
await new Promise(requestAnimationFrame);
|
await new Promise(requestAnimationFrame);
|
||||||
const slideScrollHeights = []
|
const slideScrollHeights = []
|
||||||
@ -161,7 +163,7 @@ export default class Print {
|
|||||||
}, this );
|
}, this );
|
||||||
|
|
||||||
// Create a separate page for the current fragment state
|
// Create a separate page for the current fragment state
|
||||||
let clonedPage = page.cloneNode( true );
|
const clonedPage = page.cloneNode( true );
|
||||||
pages.push( clonedPage );
|
pages.push( clonedPage );
|
||||||
|
|
||||||
previousFragmentStep = fragments;
|
previousFragmentStep = fragments;
|
||||||
|
Loading…
Reference in New Issue
Block a user