-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.bat
More file actions
28 lines (21 loc) · 860 Bytes
/
Copy pathrender.bat
File metadata and controls
28 lines (21 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@echo off
REM Render HTML deck → per-slide PNGs → lossless PDF
REM Usage: render.bat <deck.html> [output_dir]
REM Requires: Python 3.9+, playwright, img2pdf
if "%~1"=="" (
echo Usage: render.bat ^<deck.html^> [output_dir]
exit /b 1
)
set HTML=%~f1
set STEM=%~n1
set OUTDIR=%~2
if "%OUTDIR%"=="" set OUTDIR=%~dp1%STEM%_pdf
set SLIDES_DIR=%~dp1%STEM%_slides
if not exist "%OUTDIR%" mkdir "%OUTDIR%"
echo Rendering per-slide PNGs to %SLIDES_DIR%
python render_per_slide.py "%HTML%" "%SLIDES_DIR%"
if errorlevel 1 (echo PNG render failed & exit /b 1)
echo Composing PDF...
python -c "import glob,subprocess,sys; pngs=sorted(glob.glob('%SLIDES_DIR%\\slide_*.png')); subprocess.run(['img2pdf']+pngs+['--pagesize','1440x810','-o','%OUTDIR%\\deck.pdf'],check=True)"
if errorlevel 1 (echo PDF compose failed & exit /b 1)
echo Done: %OUTDIR%\deck.pdf