astefanutti / decktape

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

Error using latest docker image #154

Closed pgstef closed 6 years ago

pgstef commented 6 years ago

Hi,

I'm trying to convert a reveal.js html presentation to pdf using the latest docker image.

I got this error :

# ls -l |grep slides
-rw-r--r--. 1 root   root   3207230 Jul 17 18:59 slides.html
# docker run --rm -t -v `pwd`:/slides -v ~:/home/user astefanutti/decktape /home/user/slides.html slides.pdf
TypeError: Unable to create PDF file, make sure that output file target is available
    at /decktape/decktape.js:196:26
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)

Can anyone tell me what do I do wrong?

Many thanks in advance, Kind regards

astefanutti commented 6 years ago

I haven't been able to reproduce, by running:

$ docker run --rm -t -v `pwd`:/slides astefanutti/decktape http://lab.hakim.se/reveal-js slides.pdf
Unable to find image 'astefanutti/decktape:latest' locally
latest: Pulling from astefanutti/decktape
Status: Downloaded newer image for astefanutti/decktape:latest
Loading page http://lab.hakim.se/reveal-js ...
Loading page finished with status: 200
Reveal JS plugin activated
Printing slide #/25     (33/33) ...
Printed 33 slides

It may be a permission issue. It seems the slides.html is owned by root and read-only for other users. Would you be able to test with another file / user?

pgstef commented 6 years ago

Hi, Thank you for your answer.

I tried with another user and also tried your command but still got the same error :

[stefan@stefan user]$ pwd
/home/user
[stefan@stefan user]$ ll
total 3136
-rwxrwxrwx. 1 stefan stefan 3207230 Jul 18 21:41 slides.html
[stefan@stefan user]$ sudo docker run --rm -t -v `pwd`:/slides astefanutti/decktape slides.html slides.pdf
TypeError: Unable to create PDF file, make sure that output file target is available
    at /decktape/decktape.js:196:26
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
[stefan@stefan user]$ sudo docker run --rm -t -v `pwd`:/slides astefanutti/decktape http://lab.hakim.se/reveal-js slides.pdf
TypeError: Unable to create PDF file, make sure that output file target is available
    at /decktape/decktape.js:196:26
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
astefanutti commented 6 years ago

Hi can actually replicate the issue by read-only mounting the output directory, e.g.:

$ docker run --rm -t -v `pwd`:/slides:ro astefanutti/decktape http://lab.hakim.se/reveal-js slides.pdf
TypeError: Unable to create PDF file, make sure that output file target is available
    at /decktape/decktape.js:196:26
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)

So it tends to indicate this is a permission issue with the output directory / file.

Could you try by explicitly read-write mounting the output directory with:

$ docker run --rm -t -v `pwd`:/slides:rw astefanutti/decktape http://lab.hakim.se/reveal-js slides.pdf

Maybe it's a particular configuration of your Docker daemon. Besides, would you be able to run the command without sudo.

pgstef commented 6 years ago

Thanks for your answer. I can't run docker without sudo. That made me think to the --privileged option in docker.

I successfully ran this command :

sudo docker run --rm -it --privileged -v `pwd`:/slides astefanutti/decktape --size 1920x1080 slides.html slides.pdf

We can then consider this issue as solved :-)

astefanutti commented 6 years ago

Ok great! I'm glad we've found a way through.