astefanutti/decktape= DeckTape Antonin Stefanutti <[][@astefanutti]> // Meta :description: DeckTape is a high-quality PDF exporter for HTML presentation frameworks. :decktape-version: 3.0.0 // Settings :idprefix: :idseparator: - // Aliases :bullet: • ifdef::env-github[] :note-caption: :information_source: :icon-ban: :no_entry_sign: :icon-check: :white_check_mark: :icon-clock: :clock10: :icon-exclamation: :exclamation: :icon-exclamation-dim: :grey_exclamation: :icon-edit: :pencil2: endif::[] ifndef::env-github[] :icons: font :icon-ban: icon:ban[fw,role=red] :icon-check: icon:check-square-o[fw,role=green] :icon-clock: icon:clock-o[fw,role=silver] :icon-exclamation: icon:exclamation[fw,role=red] :icon-exclamation-dim: icon:exclamation[fw,role=silver] :icon-edit: icon:pencil[fw] endif::[] // URIs :uri-badge-npm: [] :uri-badge-node: [] :uri-decktape-npm: [] :uri-decktape-release: [***]
:uri-puppeteer: [] :uri-w3c-uievents-key: []
:uri-docker: [] :uri-docker-hub: [] :uri-docker-image: [] :uri-docker-ref: []
:uri-bespokejs: [] :uri-deckjs: [] :uri-dzslides: [] :uri-flowtimejs: [] :uri-impressjs: [] :uri-inspire: [] :uri-nuedeck: [] :uri-pageres: [] :uri-remark: [] :uri-revealjs: [] :uri-rise: [] :uri-shower: [] :uri-slidy: [] :uri-webslides: []
image:{uri-badge-npm}[link="{uri-decktape-npm}"] image:{uri-badge-node}[]
{description}
DeckTape is built on top of {uri-puppeteer}[Puppeteer] which relies on Google Chrome for laying out and rendering Web pages and provides a headless Chrome instance scriptable with a JavaScript API.
DeckTape currently supports the following presentation frameworks out of the box:
{uri-bespokejs}[Bespoke.js]{bullet} {uri-deckjs}[deck.js]{bullet} {uri-dzslides}[DZSlides]{bullet} {uri-flowtimejs}[Flowtime.js]{bullet} {uri-impressjs}[impress.js]{bullet} {uri-inspire}[Inspire.js]{bullet} {uri-nuedeck}[NueDeck]{bullet} {uri-remark}[remark]{bullet} {uri-revealjs}[reveal.js]{bullet} {uri-rise}[RISE]{bullet} {uri-shower}[Shower]{bullet} {uri-slidy}[Slidy]{bullet} {uri-webslides}[WebSlides]
DeckTape also provides a <<generic,generic command>> that works by emulating the end-user interaction, allowing it to be used to convert presentations from virtually any kind of framework. The generic mode is particularly useful for supporting HTML presentation frameworks that don't expose an API or accessible state.
DeckTape's plugin-based architecture exposes an extension API, making it possible to add support for other frameworks or to tailor existing plugins to your specific needs.
DeckTape can optionally be used to capture screenshots of your slide decks in various resolutions (similar to {uri-pageres}[pageres]). That can be useful to make sure your presentations are responsive or to create handouts for them.
You can browse some slide deck <<examples,examples>> below that have been exported with DeckTape.
== Install
=== NPM
Install DeckTape globally and run it:
sh$ npm install -g decktape $ decktape
Or locally:
sh$ npm install decktape $ `npm bin`/decktape
See the <<faq,FAQ>> for troubleshooting / alternatives.
== Usage
$ decktape -h
Usage: decktape [options] [command]
command one of: automatic, bespoke, deck, dzslides, flowtime, generic, impress, inspire, nuedeck, remark, reveal, shower, slidy, webslides url URL of the slides deck filename Filename of the output PDF file
Options:
-s
In addition to the general options listed above, command specific options can be displayed the following way:
$ decktape
== Commands
[#automatic]
=== automatic
Iterates over the available link:plugins[], picks the compatible one for presentation at the specified url and uses it to export and write the PDF into the specified filename.
[#generic]
=== generic
Emulates the end-user interaction by pressing the key with the specified --key option and iterates over the presentation as long as:
[loweralpha]
. Any change to the DOM is detected by observing mutation events targeting the body element and its subtree nor
. the number of slides exported has reached the specified --max-slides option.
The --key value must be one of the {uri-w3c-uievents-key}[UI events KeyboardEvent key values] and defaults to ArrowRight, e.g.:
$ decktape generic --key=ArrowDown
== Options
=== --screenshots
Captures each slide as an image at the --screenshots-size resolution, exports it to the --screenshots-format image format and writes the output into the --screenshots-directory directory.
The --screenshots-size option can be set multiple times. For example:
$ decktape --screenshots --screenshots-size=400x300 --screenshots-size=800x600
=== --slides
Exports only the slides specified as a series of slides indexes and ranges, e.g.:
$ decktape --slides 1
$ decktape --slides 1,3,5
$ decktape --slides 1-10
The rendering stops and the file written out after the largest numbered slide is exported.
== Examples
The following slide deck examples have been exported using DeckTape:
[cols="1v,1v,1v"] |=== |HTML5 Presentation |Framework |Exported PDF
|[][ES6+ maintenant !] |reveal.js |[][devoxx-es6-maintenant.pdf] (2.3MB)
|[][reveal.js MathJax example] |reveal.js |[][reveal-js-mathjax.pdf] (0.3MB)
|[][Getting Involved in Open Source] |reveal.js |[][opensource-getting-involved.pdf] (0.6MB)
|[][Going Further with CDI] |Asciidoctor + DZSlides |[][going-further-with-cdi.pdf] (2.4MB)
|[][Deck.js Modern HTML Presentations] |deck.js |[][deck-js-presentation.pdf] (0.5MB)
|[][The Official Remark Slideshow] |remark |[][remark-js-slideshow.pdf] (0.15MB)
|[][Coloured Terminal Listings in Remark] |remark |[][remark-js-coloured-terminal.pdf] (0.12MB)
|[][HTML Slidy: Slide Shows in HTML and XHTML] |Slidy |[][html-slidy-presentation.pdf] (0.5MB)
|[][Inspire.js: Lean, hackable, extensible slide deck framework] |Inspire.js |[][inspirejs-sample-slideshow.pdf] (1.9MB)
|[][Shower Presentation Engine] |Shower |[][shower-presentation-engine.pdf] (0.6MB)
|[][Welcome our new ES5 Overloards] |Bespoke.js |[][new-es5-overloards.pdf] (0.2MB)
|[][Spectacle: A ReactJS Presentation Library] |Spectacle |[][spectacle-reactjs-presentation.pdf] (8.9MB) |===
== Docker
DeckTape can be executed within a Docker container from the command-line using the {uri-docker-image}[astefanutti/decktape] Docker image available on {uri-docker-hub}[Docker Hub]:
$ docker run astefanutti/decktape -h
For example:
To convert an online HTML presentation and have it exported into the working directory under the slides.pdf filename:
[source,shell,subs=attributes+]
$ docker run --rm -t -v pwd:/slides astefanutti/decktape [***] slides.pdf
Or, to convert an HTML presentation that's stored on the local file system in the home directory:
[source,shell]
$ docker run --rm -t -v pwd:/slides -v ~:/home/user astefanutti/decktape /home/user/slides.html slides.pdf
Or, to convert an HTML presentation that's deployed on the local host:
[source,shell]
$ docker run --rm -t --net=host -v pwd:/slides astefanutti/decktape http://localhost:8000 slides.pdf
You may have to use host.docker.internal instead of localhost on macOS and Windows.
You may want to specify a tag corresponding to a released version of DeckTape for the Docker image, e.g. astefanutti/decktape:{decktape-version}.
Besides, it is recommended to use the following options from the {uri-docker-ref}/run[docker run] command:
{uri-docker-ref}/run/#clean-up-rm[--rm]:: DeckTape is meant to be run as a short-term foreground process so that it's not necessary to have the container's file system persisted after DeckTape exits,
{uri-docker-ref}/commandline/run/#mount-volume-v-read-only[-v]:: to mount a data volume so that DeckTape can directly write to the local file system.
Alternatively, you can use the {uri-docker-ref}/commandline/cp[docker cp] command, e.g.:
$ docker run astefanutti/decktape {uri-revealjs} slides.pdf
$ docker cp docker ps -lq:slides/slides.pdf .
docker ps -lqIf your presentation relies on fonts installed on the host system, but not in the base Docker container, you can mount your fonts directory as a volume, e.g. for macOS:
[source] $ docker run -v "${HOME}/Library/Fonts:/home/node/.local/share/fonts" ...
== FAQ
=== Install
Yes, it is available at [***]
=== Usage
--chrome-arg option, e.g.:
+
[source,shell]The list of Chromium flags can be found [***][here].
=== Troubleshooting
Arch Linux, among other Linux distributions may have the user namespace in the kernel disabled by default. You can verify this by accessing chrome://sandbox in your chrom[e|ium] browser. You can find more about sandboxing, [***][here]. As a temporary work-around, you can pass --chrome-arg=--no-sandbox as a CLI option.
--disable-web-security flag option, e.g.:
+
[source,shell]Decktape relies on Pupeteer to convert each slide in PDF format. Slight layout inconsistencies can result as part of this transformation. One workaround is to set a specific slide size using the -s option. The value of -s 1024x768 has generally worked well in such situations.
+
Decktape does not use the built-in PDF support of reveal.js, and instead captures each slide individually. Therefore you must not append ?print-pdf or load the print stylesheets in any other way when using Decktape.
== Plugin API
{icon-edit}
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务