I have activated slideNumber for my reveal.js based slides and they show up nicely on the HTML view.
Now I would like to also show them on the PDF printout that I generate with Chrome as suggested on the documentation.
It seems that its all one large page so even header and footer display only once for all slides rather than on each slide. Is there a way to print reveal.js slides that works nicely for these sort of things?
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:
slide-number
" inside the file.display: none
or similar?slide-number
accordingly.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!
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
.
well, one ugly hack will be to:
1. take sequential screenshots.
2. embed each shot in a pdf file.
(or 3. embed it in a ppt and convert ppt into pdf)
Other than that, I couldn't find anything that'd convert it to a good-looking pdf with ease.
Although I still couldn't find a precise solution, I do have, as the title suggests, an elegent hack.
A firefox plugin named Grab Them All.
It's basically a script that accesses links in a predefined list and takes screenshots and saves them. But as it's a only a hack, there's some (a lot) of manual work to do.
Firstly, you need to provide hard links to all the webpages, ie, slides in presentation, in a .txt
file. I did so in a file called paths.txt
and these were the contents in my case:
file:///C:/absolute_path_to_presentation_folder/presentation.html#/
file:///C:/absolute_path_to_presentation_folder/presentation.html#/1
file:///C:/absolute_path_to_presentation_folder/presentation.html#/2
file:///C:/absolute_path_to_presentation_folder/presentation.html#/2/1
file:///C:/absolute_path_to_presentation_folder/presentation.html#/2/2
Second and final step: after iNstalling the addon and restarting firefox, just start the addon. It opens a popup like this:
Now, it's as simple as 1,2,3. Select the file with URLs
, select the destination directory
and reduce the Max page processing time
.
And Voila! Let's go
All the slides will be downloaded as png format in sequential order. What's left to do is put them in a ppt or pdf format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With