Exporting
Slides
PDF
Exporting to PDF or PNG relies on Playwright for rendering. You will therefore need to install
playwright-chromiumto use this feature. If you are doing exporting in a CI environment, the playwright CI guide can be helpful.
- Install
playwright-chromium:
$ npm i -D playwright-chromium- Now export your slides to PDF using the following command:
$ slidev exportAfter a few seconds, your slides will be ready at ./slides-export.pdf.
PNGs and Markdown
When passing in the --format png option, Slidev will export PNG images for each slide instead of a PDF:
$ slidev export --format pngYou can also compile a markdown file composed of compiled png using --format md:
$ slidev export --format mdDark mode
In case you want to export your slides using the dark version of the theme, use the --dark option:
$ slidev export --darkExport Clicks Steps
Available since v0.21
By default, Slidev exports one page per slide with clicks animations disabled. If you want to export slides with multiple steps into multiple pages, pass the --with-clicks option:
$ slidev export --with-clicksPrint Template
By default, Slidev uses the default template to print your slides to PDF. You can also specify the print template with the --template (-t) option:
$ slidev export --template notesCurrently, Slidev provides the following templates:
default: Slides only template. Eachnotes: Notes only.
But it is also possible to create your own print template. See Custom Print Templates for details.
Slide range
You can also specify a range of slides to export with the --range option:
$ slidev export --range 1,4-5,6PDF outline
Available since v0.36.10
You can generate the PDF outline by passing the --with-toc option:
$ slidev export --with-tocOutput filename
You can specify the output filename with the --output option:
$ slidev export --output my-pdf-exportOr in the frontmatter configuration:
---
exportFilename: my-pdf-export
---Export a range of slides
By default, all slides in the presentation are exported. If you want to export a specific slide or a range of slides you can set the --range option and specify which slides you would like to export:
$ slidev export --range 1,6-8,10This option accepts both specific slide numbers and ranges.
The example above would export slides 1,6,7,8 and 10.
Multiple entries
You can also export multiple slides at once:
$ slidev export slides1.md slides2.mdOr
$ slidev export *.md # This based on your shellIn this case, each input file will generate its own PDf file.
Single-Page Application (SPA)
See Static Hosting.
Exportable Docker Image
To support the export feature, there is a docker image (maintained by @tangramor) with tag playwright. Run following command in your work folder:
docker run --name slidev --rm -it \
-v ${PWD}:/slidev \
-p 3030:3030 \
-e NPM_MIRROR="https://registry.npmmirror.com" \
tangramor/slidev:playwrightThen you can use the export feature like following under your work folder:
docker exec -i slidev npx slidev export --timeout 2m --output slides.pdfTroubleshooting
Timeout
For big presentations you might want to increase the Playwright timeout with --timeout:
$ slidev export --timeout 60000Wait
Some parts of your slides may require a longer time to render. You can use the --wait option to have an extra delay before exporting.
$ slidev export --wait 10000Executable path
Chromium may miss some features like codecs that are required to decode some videos. You can set the browser executable path for Playwright to your Chrome or Edge using --executable-path:
$ slidev export --executable-path [path_to_chromium]