|
@@ -6,6 +6,7 @@
|
|
|
*
|
|
|
* @author Manuel Bieh (https:
|
|
|
* @author Hakim El Hattab (https:
|
|
|
+ * @author Manuel Riezebosch (https:
|
|
|
*/
|
|
|
|
|
|
|
|
@@ -21,11 +22,11 @@ if( outputFile.match( /\.pdf$/gi ) === null ) {
|
|
|
outputFile += '.pdf';
|
|
|
}
|
|
|
|
|
|
-console.log( 'Export PDF: Reading reveal.js config [1/3]' );
|
|
|
+console.log( 'Export PDF: Reading reveal.js config [1/4]' );
|
|
|
|
|
|
probePage.open( inputFile, function( status ) {
|
|
|
|
|
|
- console.log( 'Export PDF: Preparing print layout [2/3]' );
|
|
|
+ console.log( 'Export PDF: Preparing print layout [2/4]' );
|
|
|
|
|
|
var config = probePage.evaluate( function() {
|
|
|
return Reveal.getConfig();
|
|
@@ -40,14 +41,22 @@ probePage.open( inputFile, function( status ) {
|
|
|
};
|
|
|
|
|
|
printPage.open( inputFile, function( status ) {
|
|
|
- window.setTimeout( function() {
|
|
|
- console.log( 'Export PDF: Writing file [3/3]' );
|
|
|
+ console.log( 'Export PDF: Preparing pdf [3/4]')
|
|
|
+ printPage.evaluate(function() {
|
|
|
+ Reveal.isReady() ? window.callPhantom() : Reveal.addEventListener( 'pdf-ready', window.callPhantom );
|
|
|
+ });
|
|
|
+ } );
|
|
|
+
|
|
|
+ printPage.onCallback = function(data) {
|
|
|
+
|
|
|
+
|
|
|
+ setTimeout(function() {
|
|
|
+ console.log( 'Export PDF: Writing file [4/4]' );
|
|
|
printPage.render( outputFile );
|
|
|
console.log( 'Export PDF: Finished successfully!' );
|
|
|
phantom.exit();
|
|
|
- }, 1000 );
|
|
|
- } );
|
|
|
-
|
|
|
+ }, 0);
|
|
|
+ };
|
|
|
}
|
|
|
else {
|
|
|
|
|
@@ -55,7 +64,6 @@ probePage.open( inputFile, function( status ) {
|
|
|
phantom.exit(1);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
} );
|
|
|
|
|
|
|