返回 slidev
core-exporting.md
根目录 / skills / slidev / references / core-exporting.md
1 ---
2 name: exporting
3 description: Export presentations to PDF, PPTX, PNG, or Markdown
4 ---
5
6 # Exporting Slides
7
8 Export presentations to PDF, PPTX, PNG, or Markdown.
9
10 ## Browser Exporter
11
12 Access at `http://localhost:3030/export`:
13 - Select format and options
14 - Preview and download
15 - PPTX here is image-based; use the CLI for `pptx-editable`
16
17 ## CLI Export
18
19 Requires playwright:
20 ```bash
21 pnpm add -D playwright-chromium
22 ```
23
24 ### PDF Export
25
26 ```bash
27 slidev export
28 slidev export --output my-slides.pdf
29 ```
30
31 ### PowerPoint Export
32
33 ```bash
34 slidev export --format pptx # each slide as an image
35 slidev export --format pptx-editable # native shapes, selectable text
36 ```
37
38 `pptx-editable` measures the rendered slides and rebuilds them as PowerPoint shapes. SVG (including Mermaid), canvas, iframes, KaTeX formulas, gradients and CSS filters stay pictures, and any slide that cannot be rebuilt falls back to the image export on its own. Fonts are named, not embedded. `--per-slide` is not supported with it.
39
40 ### PNG Export
41
42 ```bash
43 slidev export --format png
44 slidev export --format png --range 1-5
45 ```
46
47 ### Markdown Export
48
49 ```bash
50 slidev export --format md
51 ```
52
53 ## Export Options
54
55 ### With Click Steps
56
57 Export each click as separate page (default for PPTX formats):
58 ```bash
59 slidev export --with-clicks
60 ```
61
62 ### Dark Mode
63
64 ```bash
65 slidev export --dark
66 ```
67
68 ### Slide Range
69
70 ```bash
71 slidev export --range 1,4-7,10
72 ```
73
74 ### Table of Contents
75
76 PDF with clickable outline:
77 ```bash
78 slidev export --with-toc
79 ```
80
81 ### Timeout
82
83 For slow-rendering slides:
84 ```bash
85 slidev export --timeout 60000
86 ```
87
88 ### Wait
89
90 Wait before capture:
91 ```bash
92 slidev export --wait 2000
93 ```
94
95 ### Wait Until
96
97 Wait condition:
98 ```bash
99 slidev export --wait-until networkidle # Default
100 slidev export --wait-until domcontentloaded
101 slidev export --wait-until load
102 slidev export --wait-until none
103 ```
104
105 ### Transparent Background
106
107 ```bash
108 slidev export --omit-background
109 ```
110
111 ### Custom Browser
112
113 ```bash
114 slidev export --executable-path /path/to/chrome
115 ```
116
117 ## Headmatter Options
118
119 ```yaml
120 ---
121 exportFilename: my-presentation
122 download: true # Add download button in build
123 export:
124 format: pdf
125 timeout: 30000
126 withClicks: false
127 ---
128 ```
129
130 ## Troubleshooting
131
132 ### Missing Content
133
134 Increase wait time:
135 ```bash
136 slidev export --wait 3000 --timeout 60000
137 ```
138
139 ### Wrong Global Layer State
140
141 Use `--per-slide` (not supported with `pptx-editable`) or use `slide-top.vue` instead of `global-top.vue`.
142
143 ### Broken Emojis
144
145 Use system fonts or install emoji font on server.
146
147 ### CI/CD Export
148
149 Install playwright browsers:
150 ```bash
151 npx playwright install chromium
152 ```
153
153 lines MARKDOWN