Exporting
Usually the slides are displayed in a web browser, but you can also export them to PDF, PPTX, PNG, or Markdown files for sharing or printing. This feature is available through the CLI command slidev export.
However, interactive features in your slides may not be available in the exported files. You can build and host your slides as a web application to keep the interactivity. See Building and Hosting for more information.
Preparation
Exporting to PDF, PPTX, or PNG relies on Playwright for rendering the slides. Therefore playwright-chromium is required to be installed in your project:
$ npm i -D playwright-chromium$ pnpm add -D playwright-chromium$ yarn add -D playwright-chromiumFormats
PDF
After installing playwright-chromium as described above, you can export your slides to PDF using the following command:
$ slidev exportBy default, the PDF will be placed at ./slides-export.pdf.
PPTX
Slidev can also export your slides as a PPTX file:
$ slidev export --format pptxNote that all the slides in the PPTX file will be exported as images, so the text will not be selectable. Presenter notes will be conveyed into the PPTX file on a per-slide basis.
In this mode, the --with-clicks option is enabled by default. To disable it, pass --with-clicks false.
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 mdOptions
Here are some common options you can use with the slidev export command. For a full list of options, see the CLI documentation.
Export 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-clicksOutput 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 with Range
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 Exports
You can also export multiple slides at once:
$ slidev export slides1.md slides2.mdOr
$ slidev export *.mdIn this case, each input file will generate its own PDF file.
Dark Mode
In case you want to export your slides using the dark version of the theme, use the --dark option:
$ slidev export --darkTimeouts
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 10000There is also a --wait-until option to wait for a state before exporting each slide. If you keep encountering timeout issues, you can try setting this option:
$ slidev export --wait-until nonePossible values:
'networkidle'- (default) consider operation to be finished when there are no network connections for at least500ms. This is the safest, but may cause timeouts.'domcontentloaded'- consider operation to be finished when theDOMContentLoadedevent is fired.'load'- consider operation to be finished when theloadevent is fired.'none'- do not wait for any event.
WARNING
When specifying values other than 'networkidle', please make sure the printed slides are complete and correct. If some contents are missing, you may need to use the --wait option.
Executable 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]PDF Outline
Available since v0.36.10
You can generate the PDF outline by passing the --with-toc option:
$ slidev export --with-toc