astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.19k stars 176 forks source link

Decktape fails on presentation based on reveal.js 4 #223

Closed pfisterer closed 4 years ago

pfisterer commented 4 years ago

I have updated my slides to the latest version of reveal.js (4.0.2) and I'm using the latest docker image of astefanutti/decktape to export my slides to PDF:

$ docker pull astefanutti/decktape

$ docker run --rm -v "$PWD/__pdfs__:/slides" astefanutti/decktape reveal \
          http://localhost:5500/index.html /slides/out.pdf

After updating my slides, I get the following error:

Loading page http://localhost:5500/index.html ...
Live reload enabled.
Registering handlers for toggle class on click
Failed to load resource: the server responded with a status of 404 (Not Found)
Loading page finished with status: 200

Error: Unable to activate the Reveal JS DeckTape plugin for the address: http://localhost:5500/index.html

Maybe this is related to one of the (breaking) changes listed here: Upgrading From Version 3 to 4.0.

astefanutti commented 4 years ago

Could you make sure that Reveal is not configured as embedded: https://revealjs.com/presentation-size/#embedded?

pfisterer commented 4 years ago

@astefanutti thank you. I've explicitly added Reveal.initialize({ embedded: false /* , other stuff */ }); but it didn't change anything - it also seems to be the default value.

astefanutti commented 4 years ago

I've just tried on some examples from HEAD revision of Reveal master branch and it works: https://github.com/hakimel/reveal.js/tree/master/examples.

It seems the Decktape Reveal plugin cannot activate, meaning that it cannot find the Reveal global variable, which is quite surprising (though expected in embedded mode).

I fail to find a possible cause. Would you be able to share your presentation so that I can troubleshoot the issue?

pfisterer commented 4 years ago

@astefanutti Thanks for pushing me in the right direction. I needed to export Reveal using window.Reveal = Reveal

I was using

<script type="module"> 
      import Reveal from 'dependencies/reveal.js/dist/reveal.esm.js';
</script>

So now, I use

<script type="module"> 
      import Reveal from 'dependencies/reveal.js/dist/reveal.esm.js';
      window.Reveal = Reveal
</script>

Thanks!

astefanutti commented 4 years ago

Thanks for the feedback. I'm glad it works!