PDF printer module API feedback

71 views
Skip to first unread message

Antonin Stefanutti

unread,
Jun 5, 2015, 9:50:02 AM6/5/15
to phan...@googlegroups.com
Hi everyone,

I've been working lately on a PDF exporter for HTML presentation frameworks like reveal.js, impress.js and the likes. Given the slide-based / dynamic nature of the Web pages produced by these frameworks, I haven't been able to meet my need with the existing Web page module API. Indeed, it only provides a way to print the Web page into a PDF document while exporting HTML slides consists in printing multiple pages / frames into a single PDF document.

To be able to export a whole slide deck into a single PDF document, I've drafted a new PDF printer module API and I'd like to have feedback whether this is a valid approach and what can be improved to eventually have it merged into PhantomJS out of the box.

This new PDF printer is mainly used in a loop that navigate through all the slides and print each of them and finally write the PDF document. This is achieved in the following JavaScript:

https://github.com/astefanutti/decktape/blob/d48327b9160780c1563dc8f18a70fe08eaa12ce9/decktape.js#L87-L102

The printer main class is here:

https://github.com/astefanutti/phantomjs/blob/b34c4277cc9e5c23d45620a4e70fd14d0bd894d7/src/printer.h
https://github.com/astefanutti/phantomjs/blob/b34c4277cc9e5c23d45620a4e70fd14d0bd894d7/src/printer.cpp

And the complete changelist: https://github.com/astefanutti/phantomjs/commit/9ef0713e880ad0cb2e8a3ecbdf175ea8d191e419

Some examples of exported HTML slides can be found here: https://github.com/astefanutti/decktape#examples

Finally, the complete project: https://github.com/astefanutti/decktape

I'd really appreciate your feedback.

Thanks,
Antonin
https://github.com/astefanutti/
https://twitter.com/astefanut

Marc Laporte

unread,
Aug 16, 2015, 8:02:49 PM8/16/15
to phantomjs
Hi!

Very interesting!

Any progress to report?

Thanks!

Reply all
Reply to author
Forward
0 new messages