astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.16k stars 175 forks source link

PDF internal links #49

Open robertosanval opened 8 years ago

robertosanval commented 8 years ago

I've a reveal presentation that exports very well with this command:

$ ./bin/phantomjs decktape.js reveal http://reveal.local/ reveal.pdf

The problem is on the internal PDF links that opens the browser to go to the original content.

What I'd like is that the internal links of the presentation converts to internal links in PDF.

Is that possible? I'm doing something wrong?

My HTML links are like this one:

<a href="#/section-01">Internal example link</a>

Thanks

astefanutti commented 8 years ago

Hyperlinks are currently rendered as PDF link annotation with the URI action irrespective whether they happen to be internal links or not. This has been implemented as part of DeckTape development with Vitallium/qtwebkit@ef91a25 and Vitallium/qtbase@d50c481. This should be possible to detect internal links and have them rendered as GoTo action instead of URI, as defined in the PDF specification. I think wkhtmltopdf already provides something similar so that could be a start to provide support for it.

jonathanlilly commented 7 years ago

I agree, this would be a very useful feature!

gtolomei commented 6 years ago

Hello,

Sorry for jumping onboard this discussion, which apparently seems already closed. Thanks to the strong support of @astefanutti I finally managed to generate good-looking pdf from RISE slideshow in Jupyter Notebook. Here's the command I'm using at the moment to achieve that task: > decktape rise http://localhost:8888/notebooks/{NOTEBOOK_NAME}.ipynb?token={TOKEN} --load-pause 5000 -s 1920x1080 ~/path/to/outputfile.pdf Everything seems to work fine except for the hyperlinks included in my original slides. Those are correctly rendered in the final pdf (i.e., they appear as blue-colored and underlined) but unfortunately they are not clickable. I've tried opening the generated pdf both with Preview and Acrobat Reader but in none of them hyperlinks work fine. That's why I'm guessing there might be something odd while processing those hyperlinks. Instead, hyperlinks work smoothly when presenting my RISE slideshow on the web browser. Any help here would be much appreciated.

Thanks Kindly, Gabriele

astefanutti commented 6 years ago

@gtolomei I've added support for hyperlinks in version 2.2.0. Maybe you'll need to upgrade. This works for hyperlinks but not internal links.

gtolomei commented 6 years ago

Thanks a lot @astefanutti for your quick reply! I've just updated decktape to the latest version (2.2.2) and (external) hyperlinks work like a charm!

P.S.: In my RISE slideshow I have some Markdown cells which are left "unrun" on purpose (i.e., suppose you want to show the actual content of a Markdown cell on a slide and in the next slide you show how this actually renders); however, it seems decktape needs to run all the cells to produce the final pdf. Essentially, this leads to duplicate slides. Is there any overcome to this you may be aware of? Otherwise, I guess I will just skip the "unrun" cells.

Thanks a lot again, Gabriele

astefanutti commented 6 years ago

Issue with the RISE plugin followed-up in #111.