phantom export throws error if reveal.js isn't present

This commit is contained in:
Hakim El Hattab 2017-02-15 11:43:57 +01:00
parent bef8109506
commit fa70a7a517

View file

@ -31,20 +31,30 @@ probePage.open( inputFile, function( status ) {
return Reveal.getConfig(); return Reveal.getConfig();
} ); } );
printPage.paperSize = { if( config ) {
width: config.width * ( 1 + config.margin ),
height: config.height * ( 1 + config.margin ),
border: 0
};
printPage.open( inputFile, function( status ) { printPage.paperSize = {
window.setTimeout( function() { width: Math.floor( config.width * ( 1 + config.margin ) ),
console.log( 'Export PDF: Writing file [3/3]' ); height: Math.floor( config.height * ( 1 + config.margin ) ),
printPage.render( outputFile ); border: 0
console.log( 'Export PDF: Finished successfully!' ); };
phantom.exit();
}, 1000 ); printPage.open( inputFile, function( status ) {
} ); window.setTimeout( function() {
console.log( 'Export PDF: Writing file [3/3]' );
printPage.render( outputFile );
console.log( 'Export PDF: Finished successfully!' );
phantom.exit();
}, 1000 );
} );
}
else {
console.log( 'Export PDF: Unable to read reveal.js config. Make sure the input address points to a reveal.js page.' );
phantom.exit(1);
}
} ); } );