[Chennaipy] Convert HTML Presentation to PDF

Gaurav Sehrawat igauravsehrawat at gmail.com
Sat Jan 10 18:25:03 CET 2015


thanks for sharing !

On Sat, Jan 10, 2015 at 10:16 PM, Venkatesh U <
venkatesh.umaashankar at gmail.com> wrote:

> Good idea Vijay.
> On Jan 10, 2015 9:58 PM, "Vijay Kumar" <vijaykumar at zilogic.com> wrote:
>
>> Hi Everyone,
>> In the last meetup, I did my presentation using asciidoc and
>> dzslides. http://paulrouget.com/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()
>> browser.set_window_size(1600, 1200)
>> browser.get("file:///path/to/slides.html")
>>
>> for i in range(40):
>>     browser.save_screenshot("frame%02d.png" % i)
>>     section = browser.find_element_by_tag_name("section")
>>     section.send_keys(" ")
>>
>> browser.quit()
>> ------
>>
>> The series of screenshots can then be converted to PDF using the
>> following command.
>>
>> ------
>> $ 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.
>>
>> Regards,
>> Vijay
>> _______________________________________________
>> Chennaipy mailing list
>> Chennaipy at python.org
>> https://mail.python.org/mailman/listinfo/chennaipy
>>
>
> _______________________________________________
> Chennaipy mailing list
> Chennaipy at python.org
> https://mail.python.org/mailman/listinfo/chennaipy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chennaipy/attachments/20150110/f7655d0f/attachment.html>


More information about the Chennaipy mailing list