diff options
| author | mo k <mo@mokhan.ca> | 2013-02-17 22:12:28 -0700 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2013-02-17 22:12:28 -0700 |
| commit | 75fa02488b043726dd62abbc77e02715373c850b (patch) | |
| tree | 1443510cee226ed74d5a1b583a8f7133cffbd1f4 /plugin/print-pdf | |
| parent | c0d4345557d8cf10e9fe44d751a39118d50b3639 (diff) | |
add reveal.js
Diffstat (limited to 'plugin/print-pdf')
| -rwxr-xr-x | plugin/print-pdf/print-pdf.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugin/print-pdf/print-pdf.js b/plugin/print-pdf/print-pdf.js new file mode 100755 index 0000000..2b1d691 --- /dev/null +++ b/plugin/print-pdf/print-pdf.js @@ -0,0 +1,39 @@ +/** + * 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.paperSize = { + format: 'A4', + orientation: 'landscape', + margin: { + left: '0', + right: '0', + top: '0', + bottom: '0' + } +}; +page.zoomFactor = 1.5; + +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(); +} );
\ No newline at end of file |
