https://github.com/KubaSzostak/pdf-to-jpg
REM pdf-to-jpg.bat
REM Add double quote to %JPGFILE% %PDFFILE%, error output to %LOGFILE%
REM echo off
echo.
echo.
set DPI=300
set ALPHABITS=2
set QUALITY=80
set FIRSTPAGE=1
set LASTPAGE=9999
REM MEMORY in MB
set MEMORY=300
cd /D %~dp1
set PDFFILE=%~nx1
set JPGFILE=%PDFFILE:.pdf=-%%%d.jpg
set LOGFILE=gslog.txt
set GS=%2
IF "%GS%" == "" (
set GS=bin\gswin32c.exe
)
echo Loading %GS%...
echo.
"%~dp0%GS%" -sDEVICE=jpeg -sOutputFile="%JPGFILE%" -r%DPI% -dNOPAUSE -dFirstPage=%FIRSTPAGE% -dLastPage=%LASTPAGE% -dJPEGQ=%QUALITY% -dGraphicsAlphaBits=%ALPHABITS% -dTextAlphaBits=%ALPHABITS% -dNumRenderingThreads=4 -dBufferSpace=%MEMORY%000000 -dBandBufferSpace=%MEMORY%000000 -c %MEMORY%000000 setvmthreshold -f "%PDFFILE%" -c quit || echo %DATE% %TIME%: ERROR: %1 >> "%~dp0%LOGFILE%"
echo Finished.
REM pause
REM pdf-to-jpg-64-dir.bat
set bat_file=%~dp0%pdf-to-jpg.bat
echo BEGIN
pause
if exist "%1\" (
cd /D "%1"
for %%i in ("*.pdf") do ( call "%bat_file%" "%%i" bin\gswin64c.exe )
)
echo OVER
pause