diff --git a/packages/client/internals/ExportPdfTip.vue b/packages/client/internals/ExportPdfTip.vue
new file mode 100644
index 0000000000..3093fbe8e8
--- /dev/null
+++ b/packages/client/internals/ExportPdfTip.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+ Slidev will open your browser's built-in print dialog to export the slides as PDF.
+ To export the slides correctly, please:
+
+ - Choose "Save to PDF" as the Destination.
+ - Choose "Default" as the Margin.
+ - Toggle on "Print backgrounds".
+
+
+ If you're encountering problems, please try the CLI or open an issue on GitHub.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/client/pages/export.vue b/packages/client/pages/export.vue
index 50d656819a..ea75883fed 100644
--- a/packages/client/pages/export.vue
+++ b/packages/client/pages/export.vue
@@ -11,8 +11,10 @@ import { useDarkMode } from '../composables/useDarkMode'
import { useNav } from '../composables/useNav'
import { injectionSlideScale } from '../constants'
import { configs, slideHeight, slidesTitle, slideWidth } from '../env'
+import ExportPdfTip from '../internals/ExportPdfTip.vue'
import PrintSlide from '../internals/PrintSlide.vue'
import { startScreenshotSession } from '../logic/screenshot'
+import { skipExportPdfTip } from '../state'
import Play from './play.vue'
const { slides, isPrintWithClicks, hasNext, go, next, currentSlideNo, clicks, printRange } = useNav()
@@ -36,8 +38,14 @@ useHead({
provideLocal(injectionSlideScale, scale)
+const showExportPdfTip = ref(false)
function pdf() {
- window.print()
+ if (skipExportPdfTip.value) {
+ window.print()
+ }
+ else {
+ showExportPdfTip.value = true
+ }
}
async function capturePngs() {
@@ -280,6 +288,7 @@ if (import.meta.hot) {
+
diff --git a/packages/client/state/index.ts b/packages/client/state/index.ts
index f8b41773f9..fe5d873fd0 100644
--- a/packages/client/state/index.ts
+++ b/packages/client/state/index.ts
@@ -26,6 +26,7 @@ export const currentCamera = useLocalStorage('slidev-camera', 'default',
export const currentMic = useLocalStorage('slidev-mic', 'default', { listenToStorageChanges: false })
export const slideScale = useLocalStorage('slidev-scale', 0)
export const wakeLockEnabled = useLocalStorage('slidev-wake-lock', true)
+export const skipExportPdfTip = useLocalStorage('slidev-skip-export-pdf-tip', false)
export const showPresenterCursor = useLocalStorage('slidev-presenter-cursor', true, { listenToStorageChanges: false })
export const showEditor = useLocalStorage('slidev-show-editor', false, { listenToStorageChanges: false })
diff --git a/packages/slidev/node/cli.ts b/packages/slidev/node/cli.ts
index d7f49d7e61..7e22bf84c5 100644
--- a/packages/slidev/node/cli.ts
+++ b/packages/slidev/node/cli.ts
@@ -10,7 +10,7 @@ import { verifyConfig } from '@slidev/parser'
import equal from 'fast-deep-equal'
import fs from 'fs-extra'
import { getPort } from 'get-port-please'
-import { blue, bold, cyan, dim, gray, green, underline, yellow } from 'kolorist'
+import { blue, bold, cyan, dim, gray, green, lightCyan, underline, yellow } from 'kolorist'
import openBrowser from 'open'
import yargs from 'yargs'
import { version } from '../package.json'
@@ -443,17 +443,16 @@ cli.command(
const { exportSlides, getExportOptions } = await import('./commands/export')
const port = await getPort(12445)
- console.log('!!!')
let warned = false
for (const entryFile of entry as unknown as string) {
const options = await resolveOptions({ entry: entryFile, theme }, 'export')
if (options.data.config.exportingUI !== false && !warned) {
warned = true
- console.warn(yellow('[Slidev] Exporting via CLI is no longer recommended.'))
- console.warn(
- yellow('You can use the exporting UI instead by starting the dev server as normal and visit'),
- `${blue('localhost:')}${dim('')}${blue('/export')}`,
+ console.log(lightCyan('[Slidev] Try the new exporting UI!'))
+ console.log(
+ lightCyan('You can use the exporting UI instead by starting the dev server as normal and visit'),
+ `${blue('localhost:')}${dim('')}${blue('/export')}\n`,
)
}