If you are printing HTML files which are heavily relying on CSS, the general guideline to create an 'elegant' print representation of the same HTML, is to create an appropriate CSS for print.
In RevealJS the PDF generation is controlled by the css/print/pdf.css file. So my advice is this:
- Go and locate the file pdf.css on your system.
- Open it in a text editor of your choice.
- Locate the string "
slide-number
" inside the file.
- Determine the context this string appears in: Is it commented out? Is it set to use
display: none
or similar?
- Change the setting for
slide-number
accordingly.
Update
Inside the pdf.css, there is the following section right after line 32:
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .slide-number,
.reveal .playback,
.reveal.overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
Change this to:
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .playback,
.reveal.overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
Voila!
Update 2
Meanwhile I cloned the latest sources from GitHub and tested myself...
It seems to me that there is a bug with Reveal.js' PDF generation involved. I've filed a bug report about it on GitHub.
My 'js/reveal.js' currently has the following setting:
// Display the page number of the current slide
//slideNumber: false,
slideNumber: true,
So slide numbers DO appear in the slide deck. Here is a screenshot montage showing this (skipping the title slide). The slide numbers are rather small, but they do show up:
My 'css/print/pdf.css' file has the following setting:
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
//.reveal .slide-number,
.reveal .playback,
.reveal .overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
I commented out the line which marks the .slide-number
as an element that shouldn't be printed.
However, when creating a PDF (using Chrome 39.0.2171.71 (64-bit) on Mac OSX Mavericks 10.9.5), a slide number does only appear for the first slide, not for the following slides. Here is a screenshot montage of the PDF pages (skipping the second slide):
The title slide shows navigation controls as well as slide number '0' (very small though, but it is there...). The other slides do show neither navigation controls, nor slide numbers.
My reveal.js is pulled directly from the current GitHub sources (AFAICS it is the very current one); my remote branch when pulling seems to be origin/dev
.