Converting a Reveal.js slide deck to PDF
Something I have to do every so often is convert one of my talks from their web form in Reveal.js to a PDF.
Ahead of speaking at DTX London tomorrow, I'm preparing a PDF as well as the web URL, and I've yet again forgotten how to do it, as it's just-infrequent-enough that I've not got it in my memory banks.
This is the perfect opportunity to write it as a form of blogumentation, so next time I don't have to try and remember!
We can use the excellent Decktape project to do the hard work.
To do so, we need to install decktape
, which I prefer to do in a temporary directory, as it's so infrequently used it doesn't make sense to be a globally installed tool.
From there, we can run:
# NOTE that the URL and output filename may want to change
npm exec decktape reveal --fragments http://localhost:1313/dmd-dtx/slides/ dmd-dtx.pdf
Note that --fragments
is required to handle Reveal.js' fragments (aka in-slide transitions) and will create a new page on the PDF per fragment.