File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ export async function build(
113
113
output : join ( config . build . outDir , 'slidev-exported.pdf' ) ,
114
114
base : config . base ,
115
115
dark : options . data . config . colorSchema === 'dark' ,
116
+ width : 1920 ,
117
+ height : Math . round ( 1920 / options . data . config . aspectRatio ) ,
116
118
} )
117
119
server . close ( )
118
120
}
Original file line number Diff line number Diff line change @@ -276,6 +276,8 @@ cli.command(
276
276
await server . listen ( port )
277
277
printInfo ( options )
278
278
parser . filterDisabled ( options . data )
279
+ const width = 1920
280
+ const height = Math . round ( width / options . data . config . aspectRatio )
279
281
output = await exportSlides ( {
280
282
port,
281
283
total : options . data . slides . length ,
@@ -285,6 +287,8 @@ cli.command(
285
287
timeout,
286
288
dark,
287
289
routerMode : options . data . config . routerMode ,
290
+ width,
291
+ height,
288
292
} )
289
293
console . log ( `${ green ( ' ✓ ' ) } ${ dim ( 'exported to ' ) } ./${ output } \n` )
290
294
server . close ( )
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export interface ExportOptions {
16
16
timeout ?: number
17
17
dark ?: boolean
18
18
routerMode ?: 'hash' | 'history'
19
+ width ?: number
20
+ height ?: number
19
21
}
20
22
21
23
function createSlidevProgress ( ) {
@@ -64,6 +66,8 @@ export async function exportSlides({
64
66
timeout = 500 ,
65
67
dark = false ,
66
68
routerMode = 'history' ,
69
+ width = 1920 ,
70
+ height = 1080 ,
67
71
} : ExportOptions ) {
68
72
if ( ! packageExists ( 'playwright-chromium' ) )
69
73
throw new Error ( 'The exporting for Slidev is powered by Playwright, please installed it via `npm i playwright-chromium`' )
@@ -72,8 +76,8 @@ export async function exportSlides({
72
76
const browser = await chromium . launch ( )
73
77
const context = await browser . newContext ( {
74
78
viewport : {
75
- width : 1920 ,
76
- height : 1080 ,
79
+ width,
80
+ height,
77
81
} ,
78
82
deviceScaleFactor : 1 ,
79
83
} )
@@ -105,8 +109,8 @@ export async function exportSlides({
105
109
for ( const i of pages ) {
106
110
await go ( i )
107
111
const pdf = await page . pdf ( {
108
- width : 1920 ,
109
- height : 1080 ,
112
+ width,
113
+ height,
110
114
margin : {
111
115
left : 0 ,
112
116
top : 0 ,
You can’t perform that action at this time.
0 commit comments