In the December Chennaipy meetup, I did my presentation using
dzslides. Though I liked the output,
with dzslides' CSS it was not possible to print the slides to PDF. I
was looking for ways to convert the slides to PDF, so that I can
upload them to slideshare.
After reading through various projects on the Internet, it occurred to
me that this can be easily done using selenium. The following Python
script opens up the slides, and saves a screenshot of every slide to a
separate image file. The slides are advanced by sending the SPACE key
stroke, to the browser.
from selenium import webdriver
browser = webdriver.Firefox()
for i in range(40):
browser.save_screenshot("frame%02d.png" % i)
section = browser.find_element_by_tag_name("section")
The series of screenshots can then be converted to PDF using the
$ convert frame*.png slides.pdf
Well the result is not perfect, for example, the text is no longer
selectable, in the resulting PDF, and hyperlinks do not work. But I
atleast have something, that can be uploaded to slideshare.
Add Comment |
Share: Twitter, Facebook, Buzz, ... |