revealjsで作成したスライドをpdfに出力する方法

web serverが立ち上がっていない場合、まずweb serverを起動します。

$ grunt server

 

http://localhost:9000/ にスライドが表示されますね。 そうしたら、このURLに ?print-pdf を追加します。

 

Mac OSX かつ Chrome なら ⌘ (cmd) + p で印刷モードになるので「PDF に保存」を選択し保存を押します。

これでpdfとして書き出すことができます。

 

ちなみにrevealjsのコード的には下記箇所でこの処理を行っています。 リンクが表示されていない等表示がおかしい場合は下記箇所を修正すると良いかもです。

index.html L.22 あたり。

<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
    var link = document.createElement( 'link' );
    link.rel = 'stylesheet';
    link.type = 'text/css';
    link.href = 'bower_components/reveal.js/css/print/pdf.css';
    document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>

 

参考