ArchivedTools/ScanScripts/Windows/2 - Make manual_v1.cmd

51 lines
999 B
Batchfile
Raw Permalink Normal View History

2023-12-21 00:48:37 +00:00
@echo off
set source=G:\Retro-Work
setlocal EnableDelayedExpansion
set folder=%cd%
cd work\out
choice /m "Fix paging "
if %errorlevel%==1 (
copy %source%\correct_pages.php .\ /y
php -f correct_pages.php
cd newpages
)
choice /C LSN /m "Use large (L), small (S) or no (N) lastpage "
if %errorlevel%==1 (
set page=brought_to_you_by.pdf
) else if %errorlevel%==2 (
set page=brought_to_you_by_[TABLET].pdf
)
if NOT EXIST output mkdir output
set thumb=1
for %%i in (*.tif) DO (
if !thumb!==1 (
magick convert %%i -resize 240x310^^! -quality 80%% "!folder!\thumb.jpg"
)
set thumb=2
start magick convert %%i output\%%~ni.pdf
)
pause
cd output
REM for %%i in (*.jpg) DO (
REM convert %%i %%~ni.pdf
REM )
REM del *.jpg /q
pdftk *.pdf "%source%\%page%" cat output "%folder%\_manual.pdf"
pdftk "%folder%\_manual.pdf" update_info %source%\metadata.txt output "%folder%\manual.pdf"
del *.pdf /q
REM del ..\*.* /q
del "%folder%\_manual.pdf" /q
cd %folder%
start manual.pdf
pause
call "3 - PdfToText.cmd"