Gangmax Blog

DeckTape

From here.

DeckTape is a high-quality PDF exporter for HTML5 presentation frameworks.

It can be used to generate PDF for many presentation frameworks, such as reveal.js.

Here describes how to install it via “npm” and use it locally.

1
2
3
4
5
6
7
8
9
10
11
# 1. Get into the directory.
cd reveal.js
# 2. Install decktape npm pacakge.
npm install decktape
# 3. Open another terminal and run the following command to start HTTP server:
python -m http.server
# 4. Run decktape.
node_modules/decktape/decktape.js automatic http://localhost:8000/deck.html deck.pdf
`npm bin`/decktape -s 1600x1200 automatic http://localhost:8000/toi-stress-cat-clowder.html toi_stress_cat_clowder.pdf
# 5. Run the following for more options.
`npm bin`/decktape -h

The “`npm bin`/decktape -h” command will print the following help infomation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Usage: decktape [options] [command] <url> <filename>
decktape version

command one of: automatic, bespoke, csss, deck, dzslides, flowtime, generic, impress, remark, reveal, rise, shower-1.x, shower-2.x, slidy, webslides
url URL of the slides deck
filename Filename of the output PDF file

Options:
-s <size>, --size <size> Size of the slides deck viewport: <width>x<height> (e.g. '1280x720')
-p <ms>, --pause <ms> Duration in milliseconds before each slide is exported [1000]
--load-pause <ms> Duration in milliseconds between the page has loaded and starting to export slides [0]
--screenshots Capture each slide as an image [false]
--screenshots-directory <dir> Screenshots output directory [screenshots]
--screenshots-size <size> Screenshots resolution, can be repeated
--screenshots-format <format> Screenshots image format, one of [jpg, png] [png]
--slides <range> Range of slides to be exported, a combination of slide indexes and ranges (e.g. '1-3,5,8')
--chrome-path <path> Path to the Chromium or Chrome executable to run instead of the bundled Chromium
--chrome-arg <arg> Additional argument to pass to the Chrome instance, can be repeated

Defaults to the automatic command.
Iterates over the available plugins, picks the compatible one for presentation at the
specified <url> and uses it to export and write the PDF into the specified <filename>.

For the Docker way to run, please read official document here.

Comments