Using WebKit to generate PDF slides

Today we can find a lot of presentations written in HTML or any other variant (XHTML, HTML5, etc) using JavaScript frameworks such as s5 or deck.js.

These frameworks allow the creator to do advanced presentations with simple HTML. This has a lot of advantages as the user

  • is in full control of the layout
  • can easily embed images, links, code, etc
  • can use a revision control tool

Although one major drawback of such frameworks is sharing the slides. Of course the slides can be put online on any HTTP server and be easily read from a browser, but not everyone has access to a public web server.

Also sharing the slides with someone else is bit of drag. The HTML file alone can't be emailed since the recipient will need the resources that are associated with the main document (CSS, JavaScript, images, etc). So unless all files are transfered then the presentation will not be visible in the intended way. And even then, sore resources, like fonts, could make the presentation different from one computer to another.

If you're in such situation maybe you will like these 2 programs that I have released to CPAN: s5pdf and deckjs2pdf.

As their names can tell these programs allow the user to export a slide show written in HTML with their respective JavaScript framework and to generate a PDF. This will ensure that the slides can be easily shared, after all PDF does stand for Portable Document Format!

The slides are generated with WebKit. This means that a "browser" is being used. Images, fonts, CSS and even JavaScript are all loaded and processed properly. The resulting PDF file should be a very robust representation of your slides that's easily shared with your peers or audience.

If you want to see the results of the program take a look at this talk WebKit & Perl and at its corresponding PDF slides.

8 Comments

I know it may be a little off topic, but the LaTeX world has in the last several years grown quite a remarkable presentation engine called [Beamer](https://bitbucket.org/rivanvx/beamer/wiki/Home) which does what you mention for HTML presentations but rather with LaTeX. Of course it produces PDF directly, but as it is designed for this purpose it knows how to do some "dynamic" things like incremental slides etc.

Again this is not to say that doing this with Perl+HTML+JS isn't cool, it is. But if you are simply looking for a programmatic alternative to PowerPoint, give LaTeX/Beamer a look.

A few quick last notes,
1) LaTeX is tremendously cross-platform and stable.
2) Works nicely with Template Toolkit if you want :-)
3) There is a (python) based viewer for PDF presentations, whether Beamer or otherwise, which can snazz up the viewing, called [Impressive](http://impressive.sourceforge.net/).
4)LaTeX (texlive), Beamer (something like texlive-beamer) and Impressive (impressive) are available from a debian repository near you.
5)If you are still reading this, then maybe you are interested in my Beamer/Impressive configuration engine [App::makebeamerinfo](http://p3rl.org/App::makebeamerinfo).

Super result, well done

I should say again, your concepts for HTML presentations are very cool, and are probably preferred for doing dynamic presentations. It is also nice that they can be rendered down to PDF for future viewers.

LaTeX/Beamer will be useful if you want to directly target PDF with some smaller amount of dynamic content, or when cross-platform build is desired (vs, make HTML presentation then immediately render down to PDF).

Great work! I don't mean to lessen your accomplishment!

Great work, this looks very cool.

And I disagree with the pro-beamer comments. Stay away.. it's ugly and complex. Even if you actually want a LaTex based solution, there are others that are much simpler. (Unless something fundamental changed in the last 3 years)

Stay away... there are others that are much simpler.
Which? After trying several LaTeX slides packages, I found Beamer to be the best, even using it for my thesis defense. If you want to do anything more complex than an outline in a huge font, it's the way to go.

I agree. The incrementing engine is excellent, plus when you pair it with TikZ you can do almost anything!

Leave a comment

About Potyl

user-pic Another Perl programmer.