Andrew Tomaka
f3d18656b2
Install reveal.js presentation framework using bower: bower install reveal.js --save Setup an initial slide show with a title page and resources page to conclude. It seems like the bower_components directory does not belong in the repository, but I am not familar with practices using the tool so it can be included for now.
44 lines
830 B
JavaScript
44 lines
830 B
JavaScript
/**
|
|
* phantomjs script for printing presentations to PDF.
|
|
*
|
|
* Example:
|
|
* phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf
|
|
*
|
|
* By Manuel Bieh (https://github.com/manuelbieh)
|
|
*/
|
|
|
|
// html2pdf.js
|
|
var page = new WebPage();
|
|
var system = require( 'system' );
|
|
|
|
page.viewportSize = {
|
|
width: 1024,
|
|
height: 768
|
|
};
|
|
|
|
page.paperSize = {
|
|
format: 'letter',
|
|
orientation: 'landscape',
|
|
margin: {
|
|
left: '0',
|
|
right: '0',
|
|
top: '0',
|
|
bottom: '0'
|
|
}
|
|
};
|
|
|
|
var revealFile = system.args[1] || 'index.html?print-pdf';
|
|
var slideFile = system.args[2] || 'slides.pdf';
|
|
|
|
if( slideFile.match( /\.pdf$/gi ) === null ) {
|
|
slideFile += '.pdf';
|
|
}
|
|
|
|
console.log( 'Printing PDF...' );
|
|
|
|
page.open( revealFile, function( status ) {
|
|
console.log( 'Printed succesfully' );
|
|
page.render( slideFile );
|
|
phantom.exit();
|
|
} );
|
|
|