├── tests └── language_manual.bat ├── LICENSE.md ├── modules ├── options.bat ├── directory.bat ├── date_time.bat ├── information.bat ├── language.bat ├── ghostscript.bat ├── installer.bat └── compression.bat ├── messages ├── messages_russian.txt ├── messages_ukrainian.txt └── messages_english.txt ├── installer.iss ├── batch_PDF_compressor.bat └── README.md /tests/language_manual.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2024 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | cls 6 | choice /c 123 /n /m "Choose your language (1 - English, 2 - Ukrainian, 3 - Russian): " 7 | set "lang=%errorlevel%" 8 | 9 | if "%lang%"=="2" ( 10 | chcp 65001 >nul 11 | echo Обрана мова: українська >> %outputFile% 12 | set "file_name=messages/messages_ukrainian.txt" 13 | echo. 14 | cls 15 | ) else if "%lang%"=="3" ( 16 | chcp 65001 >nul 17 | echo Выбранный язык: русский >> %outputFile% 18 | set "file_name=messages/messages_russian.txt" 19 | echo. 20 | cls 21 | ) else ( 22 | chcp 65001 >nul 23 | echo Selected language: English >> %outputFile% 24 | set "file_name=messages/messages_english.txt" 25 | echo. 26 | cls 27 | ) 28 | 29 | for /f "delims=" %%a in (%file_name%) do (set "%%a") -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 - 2025 Serhii I. Myshko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /modules/options.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | echo. 6 | echo %short_separator% 7 | echo. 8 | echo 1 - %msg_6% 9 | echo 2 - %msg_7% 10 | echo 3 - %msg_8% 11 | echo 4 - %msg_9% 12 | echo. 13 | 14 | choice /c 1234 /n /m "%msg_10%" 15 | set "compresslevel=%errorlevel%" 16 | if "%compresslevel%"=="1" set "pdfsettings=/screen" & echo %msg_6% >> %outputFile% 17 | if "%compresslevel%"=="2" set "pdfsettings=/ebook" & echo %msg_7% >> %outputFile% 18 | if "%compresslevel%"=="3" set "pdfsettings=/printer" & echo %msg_8% >> %outputFile% 19 | if "%compresslevel%"=="4" set "pdfsettings=/prepress" & echo %msg_9% >> %outputFile% 20 | echo. & echo. >> %outputFile% 21 | timeout /t 1 >nul 22 | 23 | echo %short_separator% 24 | echo. 25 | echo %msg_31% 26 | echo. 27 | choice /c 12 /n /m "(%msg_32%, %msg_33%) %msg_30%" 28 | set "delete_originals=%errorlevel%" 29 | if "%delete_originals%"=="1" echo %msg_31%: %msg_32% >> %outputFile% 30 | if "%delete_originals%"=="2" echo %msg_31%: %msg_33% >> %outputFile% 31 | timeout /t 1 >nul 32 | echo. 33 | echo %short_separator% 34 | timeout /t 1 >nul 35 | cls -------------------------------------------------------------------------------- /modules/directory.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | set "maxAttempts=3" 6 | set "attempt=1" 7 | :input_path 8 | echo. & echo. >> %outputFile% 9 | echo %msg_5% 10 | echo. 11 | set "folderSelection=" 12 | for /f "delims=" %%d in ('powershell -Command "$culture = [System.Globalization.CultureInfo]::CreateSpecificCulture('%culture%'); Add-Type -AssemblyName System.Windows.Forms; $f = New-Object Windows.Forms.FolderBrowserDialog; $f.Description = '%msg_5%'; $f.Language = $culture; $f.ShowDialog(); $f.SelectedPath"') do set "folderSelection=%%d" 13 | set "directory=%folderSelection%" 14 | echo %directory% & echo %msg_26% %directory% >> %outputFile% 15 | echo. >> %outputFile% 16 | timeout /t 1 >nul 17 | 18 | if not exist "%directory%" ( 19 | echo %msg_25% & echo %msg_25% >> %outputFile% 20 | if %attempt% lss %maxAttempts% ( 21 | set /a "attempt+=1" 22 | cls 23 | goto input_path 24 | ) else ( 25 | cls 26 | color 1C 27 | echo. & echo. >> %outputFile% 28 | echo %msg_27% & echo %msg_27% >> %outputFile% 29 | echo. & echo. >> %outputFile% 30 | pause 31 | color 32 | start notepad "%outputFile%" 33 | set "exitScript=1" 34 | timeout /t 1 >nul 35 | exit /b 36 | ) 37 | ) -------------------------------------------------------------------------------- /modules/date_time.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | set "current_date=%date%" 6 | set "current_time=%time%" 7 | 8 | if "%current_date:~0,3%" geq "A" ( 9 | @REM Date format is 'DayName mm/dd/yyyy' 10 | set "month=%current_date:~4,2%" 11 | set "day=%current_date:~7,2%" 12 | set "year=%current_date:~10,4%" 13 | ) else if "%current_date:~2,1%" equ "." ( 14 | @REM Date format is 'dd.mm.yyyy' 15 | set "day=%current_date:~0,2%" 16 | set "month=%current_date:~3,2%" 17 | set "year=%current_date:~6,4%" 18 | ) else if "%current_date:~2,1%" equ "/" ( 19 | @REM Date format is 'dd/mm/yyyy' 20 | set "day=%current_date:~0,2%" 21 | set "month=%current_date:~3,2%" 22 | set "year=%current_date:~6,4%" 23 | ) else ( 24 | @REM Date format is 'yyyy-mm-dd' 25 | set "year=%current_date:~0,4%" 26 | set "month=%current_date:~5,2%" 27 | set "day=%current_date:~8,2%" 28 | ) 29 | 30 | set "hour=%current_time:~0,2%" 31 | set "minute=%current_time:~3,2%" 32 | set "second=%current_time:~6,2%" 33 | 34 | if "%hour:~0,1%" equ " " set "hour=0%hour:~1,1%" 35 | 36 | if "%current_time:~8,1%" equ "." ( 37 | set "second=%current_time:~6,2%" 38 | set "milliseconds=%current_time:~9,2%" 39 | ) 40 | 41 | 42 | @REM Display the result (for debugging purposes) 43 | @REM echo %current_date% 44 | @REM echo %current_time% 45 | @REM echo Month: %month% 46 | @REM echo Day: %day% 47 | @REM echo Year: %year% 48 | @REM echo Hour: %hour% 49 | @REM echo Minute: %minute% 50 | @REM echo Second: %second% 51 | @REM pause -------------------------------------------------------------------------------- /modules/information.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | cls 6 | color 1E 7 | echo %double_separator% & echo %double_separator% >> %outputFile% 8 | echo. & echo. >> %outputFile% 9 | echo %msg_18% & echo %msg_18% >> %outputFile% 10 | echo. & echo. >> %outputFile% 11 | echo %double_separator% & echo %double_separator% >> %outputFile% 12 | timeout /t 1 >nul 13 | 14 | echo. & echo. >> %outputFile% 15 | echo %msg_19% !progress! & echo %msg_19% !progress! >> %outputFile% 16 | echo. & echo. >> %outputFile% 17 | echo %msg_20% !progress_compression! & echo %msg_20% !progress_compression! >> %outputFile% 18 | echo. & echo. >> %outputFile% 19 | echo %msg_21% !progress_already_compressed! & echo %msg_21% !progress_already_compressed! >> %outputFile% 20 | echo. & echo. >> %outputFile% 21 | echo %msg_28% !progress_error! & echo %msg_28% !progress_error! >> %outputFile% 22 | echo. & echo. >> %outputFile% 23 | echo %long_separator% & echo %long_separator% >> %outputFile% 24 | 25 | echo. & echo. >> %outputFile% 26 | echo %msg_22% %initialSizeKB%.%initialSizeKB:~-2% KB & echo %msg_22% %initialSizeKB%.%initialSizeKB:~-2% KB >> %outputFile% 27 | echo. & echo. >> %outputFile% 28 | echo %msg_24% %compressionRatio% %% & echo %msg_24% %compressionRatio% %% >> %outputFile% 29 | echo. & echo. >> %outputFile% 30 | echo %msg_23% %compressedSizeKB%.%compressedSizeKB:~-2% KB & echo %msg_23% %compressedSizeKB%.%compressedSizeKB:~-2% KB >> %outputFile% 31 | echo. & echo. >> %outputFile% 32 | echo %double_separator% & echo %double_separator% >> %outputFile% 33 | timeout /t 1 >nul -------------------------------------------------------------------------------- /modules/language.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | set "LOCALE=" 6 | for /f %%A in ('wmic os get locale ^| find "0"') do set "LOCALE=%%A" 7 | 8 | if "%LOCALE%"=="" ( 9 | for /f "tokens=3" %%A in ('reg query "HKCU\Control Panel\International" /v LocaleName 2^>nul') do set "LOCALE=%%A" 10 | ) 11 | 12 | if "%LOCALE%"=="" ( 13 | for /f %%A in ('powershell -Command "(Get-Culture).Name"') do set "LOCALE=%%A" 14 | ) 15 | 16 | if "%LOCALE%"=="" ( 17 | for /f "tokens=2 delims=:" %%A in ('systeminfo ^| find "System Locale"') do ( 18 | for /f "tokens=1 delims=;" %%B in ("%%A") do ( 19 | for /f "tokens=* delims= " %%C in ("%%B") do set "LOCALE=%%C" 20 | ) 21 | ) 22 | ) 23 | 24 | chcp 65001 >nul 25 | if "%LOCALE%"=="0422" ( 26 | echo Мова інтерфейсу: українська >> %outputFile% 27 | set "file_name=messages/messages_ukrainian.txt" 28 | echo. 29 | cls 30 | ) else if "%LOCALE%"=="0419" ( 31 | echo Язык интерфейса: русский >> %outputFile% 32 | set "file_name=messages/messages_russian.txt" 33 | echo. 34 | cls 35 | ) else if "%LOCALE%"=="uk-UA" ( 36 | echo Мова інтерфейсу: українська >> %outputFile% 37 | set "file_name=messages/messages_ukrainian.txt" 38 | echo. 39 | cls 40 | ) else if "%LOCALE%"=="ru-RU" ( 41 | echo Язык интерфейса: русский >> %outputFile% 42 | set "file_name=messages/messages_russian.txt" 43 | echo. 44 | cls 45 | ) else if "%LOCALE%"=="uk" ( 46 | echo Мова інтерфейсу: українська >> %outputFile% 47 | set "file_name=messages/messages_ukrainian.txt" 48 | echo. 49 | cls 50 | ) else if "%LOCALE%"=="ru" ( 51 | echo Язык интерфейса: русский >> %outputFile% 52 | set "file_name=messages/messages_russian.txt" 53 | echo. 54 | cls 55 | ) else ( 56 | echo Interface language: English >> %outputFile% 57 | set "file_name=messages/messages_english.txt" 58 | echo. 59 | cls 60 | ) 61 | 62 | for /f "delims=" %%a in (%file_name%) do (set "%%a") -------------------------------------------------------------------------------- /modules/ghostscript.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | :check_again 6 | set "gsRootPath64=%ProgramFiles%\gs" 7 | set "gsRootPath32=%ProgramFiles(x86)%\gs" 8 | set "gsExecutable=" 9 | 10 | for /d %%D in ("%gsRootPath64%\gs*") do ( 11 | if exist "%%D\bin\gswin64c.exe" ( 12 | set "gsExecutable=%%D\bin\gswin64c.exe" 13 | goto found_gs 14 | ) 15 | ) 16 | 17 | for /d %%D in ("%gsRootPath32%\gs*") do ( 18 | if exist "%%D\bin\gswin32c.exe" ( 19 | set "gsExecutable=%%D\bin\gswin32c.exe" 20 | goto found_gs 21 | ) 22 | ) 23 | 24 | where gswin64c.exe >nul 2>&1 25 | if errorlevel 0 ( 26 | for /f "delims=" %%I in ('where gswin64c.exe') do ( 27 | set "gsExecutable=%%I" 28 | goto found_gs 29 | ) 30 | ) 31 | 32 | where gswin32c.exe >nul 2>&1 33 | if errorlevel 0 ( 34 | for /f "delims=" %%I in ('where gswin32c.exe') do ( 35 | set "gsExecutable=%%I" 36 | goto found_gs 37 | ) 38 | ) 39 | 40 | cls 41 | echo %error_separator% & echo %error_separator% >> %outputFile% 42 | echo. & echo. >> %outputFile% 43 | echo %msg_35% & echo %msg_35% >> %outputFile% 44 | echo %msg_36% & echo %msg_36% >> %outputFile% 45 | timeout /t 2 >nul 46 | 47 | call modules/installer.bat 48 | 49 | echo %msg_52% & echo %msg_52% >> %outputFile% 50 | echo %error_separator% & echo %error_separator% >> %outputFile% 51 | 52 | if "%exitScript%"=="0" ( 53 | timeout /t 5 >nul 54 | cls 55 | goto check_again 56 | ) else ( 57 | cls & title = Batch PDF compressor 58 | color 1C 59 | echo %error_separator% & echo %error_separator% >> %outputFile% 60 | echo. & echo. >> %outputFile% 61 | echo %msg_1% & echo %msg_1% >> %outputFile% 62 | echo. 63 | echo %msg_2% & echo %msg_2% >> %outputFile% 64 | echo. 65 | echo %ghostscript_link% & echo %ghostscript_link% >> %outputFile% 66 | echo. 67 | echo %ghostscript_altlink% & echo %ghostscript_altlink% >> %outputFile% 68 | echo. 69 | echo %error_separator% & echo %error_separator% >> %outputFile% 70 | timeout /t 2 >nul 71 | echo. 72 | pause 73 | color 74 | start notepad "%outputFile%" 75 | set "exitScript=1" 76 | exit /b 77 | ) 78 | 79 | :found_gs 80 | title Batch PDF compressor 81 | color 1A 82 | echo %short_separator% 83 | echo. & echo. >> %outputFile% 84 | for /f "delims=" %%v in ('"%gsExecutable%" --version 2^>^&1') do set "ghostscript_version=%%v" 85 | echo %msg_3% %ghostscript_version% & echo %msg_3% %ghostscript_version% >> %outputFile% 86 | echo. 87 | echo %interface_lang% 88 | echo. 89 | echo %msg_4% 90 | echo. 91 | echo %short_separator% 92 | timeout /t 2 >nul 93 | color 1F 94 | -------------------------------------------------------------------------------- /modules/installer.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | title = Ghostscript installer 5 | 6 | set "latestReleaseUrl=%ghostscript_release_link%" 7 | set "jsonFile=%temp%\latest_release.json" 8 | set "installerUrl=" 9 | set "downloadedInstaller=" 10 | set "exitScript=0" 11 | set "is64Bit=0" 12 | 13 | if defined ProgramFiles(x86) ( 14 | set "is64Bit=1" 15 | echo %msg_37% & echo %msg_37% >> %outputFile% 16 | ) else ( 17 | echo %msg_38% & echo %msg_38% >> %outputFile% 18 | ) 19 | 20 | echo %msg_39% & echo %msg_39% >> %outputFile% 21 | curl -s %latestReleaseUrl% -o "%jsonFile%" 22 | if errorlevel 1 ( 23 | echo %msg_40% & echo %msg_40% >> %outputFile% 24 | set "exitScript=1" 25 | exit /b 26 | ) 27 | 28 | if not exist "%jsonFile%" ( 29 | echo %msg_41% & echo %msg_41% >> %outputFile% 30 | set "exitScript=1" 31 | exit /b 32 | ) 33 | 34 | echo %msg_42% & echo %msg_42% >> %outputFile% 35 | 36 | set "installerFound=0" 37 | if "%is64Bit%"=="1" ( 38 | echo %msg_43% & echo %msg_43% >> %outputFile% 39 | for /f "delims=" %%i in ('findstr /C:"w64.exe" "%jsonFile%"') do ( 40 | echo %msg_45% %%i & echo %msg_45% %%i >> %outputFile% 41 | set "installerFound=1" 42 | for /f "tokens=2 delims= " %%j in ('echo %%i ^| findstr /C:browser_download_url') do ( 43 | set "installerUrl=%%j" 44 | goto process_url 45 | ) 46 | ) 47 | ) else ( 48 | echo %msg_44% & echo %msg_44% >> %outputFile% 49 | for /f "delims=" %%i in ('findstr /C:"w32.exe" "%jsonFile%"') do ( 50 | echo %msg_45% %%i & echo %msg_45% %%i >> %outputFile% 51 | set "installerFound=1" 52 | for /f "tokens=2 delims= " %%j in ('echo %%i ^| findstr /C:"browser_download_url"') do ( 53 | set "installerUrl=%%j" 54 | goto process_url 55 | ) 56 | ) 57 | ) 58 | 59 | :process_url 60 | if "%installerUrl%"=="" ( 61 | echo %msg_46% & echo %msg_46% >> %outputFile% 62 | set "exitScript=1" 63 | exit /b 64 | ) 65 | 66 | set "installerUrl=%installerUrl:"=%" 67 | set "installerUrl=%installerUrl: =%" 68 | 69 | for /f "tokens=* delims=" %%k in ("%installerUrl%") do set "installerUrl=%%k" 70 | 71 | echo %msg_47% %installerUrl% & echo %msg_47% %installerUrl% >> %outputFile% 72 | 73 | set "downloadedInstaller=%temp%\GhostscriptInstaller.exe" 74 | echo %msg_48% & echo %msg_48% >> %outputFile% 75 | 76 | echo. 77 | curl -L %installerUrl% -o "%downloadedInstaller%" 78 | echo. 79 | 80 | if exist "%downloadedInstaller%" ( 81 | echo %msg_49% & echo %msg_49% >> %outputFile% 82 | start /wait "" "%downloadedInstaller%" 2>nul 83 | del /q "%downloadedInstaller%" 2>nul 84 | del /q "%jsonFile%" 2>nul 85 | echo %msg_50% & echo %msg_50% >> %outputFile% 86 | set "exitScript=0" 87 | exit /b 88 | ) else ( 89 | echo %msg_51% & echo %msg_51% >> %outputFile% 90 | set "exitScript=1" 91 | exit /b 92 | ) 93 | -------------------------------------------------------------------------------- /messages/messages_russian.txt: -------------------------------------------------------------------------------- 1 | msg_1=Ghostscript не установлен. 2 | msg_2=Пожалуйста, загрузите и установите Ghostscript по одной из ссылок: 3 | msg_3=Текущая версия Ghostscript: 4 | msg_4=Все в порядке, давайте начнем. 5 | msg_5=Выберите каталог с файлами PDF: 6 | msg_6=Низкое качество (экран) 7 | msg_7=Среднее качество (электронная книга) 8 | msg_8=Высокое качество (принтер) 9 | msg_9=Сверхвысокое качество (предпечатное) 10 | msg_10=Выберите уровень сжатия: 11 | msg_11=Проверка файла: 12 | msg_12=↓ Сжатие не требуется. Файл уже был сжат. 13 | msg_13=Общий прогресс: 14 | msg_14=Продолжается сжатие файла: 15 | msg_15=█ Сжатие не удалось. Размер сжатого файла меньше 5 килобайт. Оригинальный файл не будет удален. 16 | msg_16=↑ Успешное сжатие. Удаление оригинального файла. 17 | msg_17=█ Сжатие не удалось. Оригинальный файл не будет удален. 18 | msg_18=Сжатие завершено. Все файлы были успешно сжаты. 19 | msg_19=Всех файлов для сжатия : 20 | msg_20=Файлы, сжатые во время сеанса : 21 | msg_21=Файлы, не требующие сжатия : 22 | msg_22=Изначальный общий размер до : 23 | msg_23=Сжатый общий размер после : 24 | msg_24=Степень сжатия : 25 | msg_25=Указанный путь не существует. 26 | msg_26=Путь к каталогу с файлами PDF: 27 | msg_27=Три неудачных попытки выбрать каталог с файлами PDF. Выход. 28 | msg_28=Сжатие не произошло из-за ошибки : 29 | msg_29=несущественный 30 | msg_30=Ваш выбор: 31 | msg_31=Удаление оригиналов PDF файлов 32 | msg_32=1 - Да 33 | msg_33=2 - Нет 34 | msg_34=↑ Успешное сжатие. Оригинальный файл сохранен. 35 | msg_35=Ghostscript не установлен в вашей системе. 36 | msg_36=Выполнение необходимых действий для поиска программы установки. 37 | msg_37=Ваша система 64-разрядная. 38 | msg_38=Ваша система 32-разрядная. 39 | msg_39=Загрузка информации о последнем выпуске... 40 | msg_40=Невозможно получить информацию о последнем выпуске с GitHub. 41 | msg_41=JSON-файл не найден или не загружен. 42 | msg_42=Информация успешно загружена. 43 | msg_43=Поиск программы установки для 64-битной версии... 44 | msg_44=Поиск программы установки для 32-битной версии... 45 | msg_45=Найдена строка установщика: 46 | msg_46=Установщик для вашей системы не найден. 47 | msg_47=Установщик найден: 48 | msg_48=Загрузка программы установки... 49 | msg_49=Установщик Ghostscript успешно загружен. 50 | msg_50=Установщик Ghostscript успешно запущен. 51 | msg_51=Загрузка программы установки не удалась. 52 | msg_52=Проверка установки... 53 | copyright_link=https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md 54 | ghostscript_link=https://ghostscript.com/releases/gsdnld.html 55 | ghostscript_altlink=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases 56 | ghostscript_release_link=https://api.github.com/repos/ArtifexSoftware/ghostpdl-downloads/releases/latest 57 | culture=ru-RU 58 | interface_lang=Язык интерфейса: русский 59 | error_separator=------------------------------------------------------------------------- 60 | short_separator=--------------------------------------- 61 | long_separator=----------------------------------------------------- 62 | double_separator====================================================== -------------------------------------------------------------------------------- /messages/messages_ukrainian.txt: -------------------------------------------------------------------------------- 1 | msg_1=Ghostscript не встановлено. 2 | msg_2=Будь ласка, завантажте та встановіть Ghostscript за одним з посилань: 3 | msg_3=Поточна версія Ghostscript: 4 | msg_4=Все гаразд, давайте почнемо. 5 | msg_5=Оберіть каталог з файлами PDF: 6 | msg_6=Низька якість (екран) 7 | msg_7=Середня якість (електронна книга) 8 | msg_8=Висока якість (принтер) 9 | msg_9=Надвисока якість (до друку) 10 | msg_10=Виберіть рівень стиснення: 11 | msg_11=Перевірка файлу: 12 | msg_12=↓ Стиснення не потрібне. Файл вже було стиснуто. 13 | msg_13=Загальний прогрес: 14 | msg_14=Триває стиснення файлу: 15 | msg_15=█ Стиснення не вдалося. Розмір стисненого файлу менше 5 кілобайт. Оригінальний файл не буде видалено. 16 | msg_16=↑ Успішне стиснення. Видалення оригінального файлу. 17 | msg_17=█ Стиснення не вдалося. Оригінальний файл не буде видалено. 18 | msg_18=Стиснення завершено. Всі файли було успішно стиснуто. 19 | msg_19=Всього файлів для стиснення : 20 | msg_20=Файли, стиснуті під час сеансу : 21 | msg_21=Файли, які не потребують стиснення : 22 | msg_22=Початковий загальний розмір до : 23 | msg_23=Стиснений загальний розмір після : 24 | msg_24=Ступінь стиснення : 25 | msg_25=Вказаний шлях не існує. 26 | msg_26=Шлях до каталогу з файлами PDF: 27 | msg_27=Три невдалих спроби обрати каталог з файлами PDF. Вихід. 28 | msg_28=Стиснення не відбулося через помилку : 29 | msg_29=несуттєвий 30 | msg_30=Ваш вибір: 31 | msg_31=Видалення оригіналів PDF файлів 32 | msg_32=1 - Так 33 | msg_33=2 - Ні 34 | msg_34=↑ Успішне стиснення. Оригінальний файл збережено. 35 | msg_35=Ghostscript не встановлено у вашій системі. 36 | msg_36=Виконання необхідних кроків для пошуку інсталятора. 37 | msg_37=Ваша система 64-розрядна. 38 | msg_38=Ваша система 32-розрядна. 39 | msg_39=Завантажуємо інформацію про останній випуск... 40 | msg_40=Не вдається отримати інформацію про останній випуск з GitHub. 41 | msg_41=JSON файл не знайдено або не завантажено. 42 | msg_42=Інформацію успішно завантажено. 43 | msg_43=Пошук інсталятора для 64-бітної версії... 44 | msg_44=Пошук інсталятора для 32-бітної версії... 45 | msg_45=Знайдено рядок інсталятора: 46 | msg_46=Інсталятор для вашої системи не вдалося знайти. 47 | msg_47=Інсталятор знайдено: 48 | msg_48=Завантаження інсталятора... 49 | msg_49=Інсталятор Ghostscript успішно завантажено. 50 | msg_50=Інсталятор Ghostscript успішно запущено. 51 | msg_51=Не вдалося завантажити інсталятор. 52 | msg_52=Перевірка установки... 53 | copyright_link=https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md 54 | ghostscript_link=https://ghostscript.com/releases/gsdnld.html 55 | ghostscript_altlink=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases 56 | ghostscript_release_link=https://api.github.com/repos/ArtifexSoftware/ghostpdl-downloads/releases/latest 57 | culture=uk-UA 58 | interface_lang=Мова інтерфейсу: українська 59 | error_separator=------------------------------------------------------------------------- 60 | short_separator=--------------------------------------- 61 | long_separator=----------------------------------------------------- 62 | double_separator====================================================== -------------------------------------------------------------------------------- /messages/messages_english.txt: -------------------------------------------------------------------------------- 1 | msg_1=Ghostscript is not installed. 2 | msg_2=Download and install Ghostscript from any of the following links: 3 | msg_3=Current Ghostscript version: 4 | msg_4=It's okay, let's get started. 5 | msg_5=Select the folder with the PDF files: 6 | msg_6=Low quality (screen) 7 | msg_7=Medium quality (ebook) 8 | msg_8=High quality (printer) 9 | msg_9=Ultra quality (prepress) 10 | msg_10=Select compression level: 11 | msg_11=Checking the file: 12 | msg_12=↓ No compression is required. File has already been compressed. 13 | msg_13=Total progress: 14 | msg_14=Compressing file is in progress: 15 | msg_15=█ Compression failed. Compressed file size is less than 5 kilobytes. Original file will not be deleted. 16 | msg_16=↑ Compression successful. Deleting original file. 17 | msg_17=█ Compression failed. Original file will not be deleted. 18 | msg_18=Compression complete. All files have been compressed successfully. 19 | msg_19=Total files to be compressed : 20 | msg_20=Files compressed during the session : 21 | msg_21=Files that don't require compression : 22 | msg_22=Initial total size before : 23 | msg_23=Compressed total size after : 24 | msg_24=Compression ratio : 25 | msg_25=The provided path does not exist. 26 | msg_26=Path to the folder with PDF files: 27 | msg_27=Three failed attempts to select the folder with the PDF files. Exit. 28 | msg_28=Compression failed due to error : 29 | msg_29=insignificant 30 | msg_30=Your choice: 31 | msg_31=Delete original PDF files 32 | msg_32=1 - Yes 33 | msg_33=2 - No 34 | msg_34=↑ Compression successful. The original file is saved. 35 | msg_35=Ghostscript is not installed on your system. 36 | msg_36=Performing the necessary steps to find an installer. 37 | msg_37=Your system is 64-bit. 38 | msg_38=Your system is 32-bit. 39 | msg_39=Downloading information about the latest release... 40 | msg_40=Unable to get information about the latest release from GitHub. 41 | msg_41=JSON file not found or not loaded. 42 | msg_42=Information has been successfully uploaded. 43 | msg_43=Finding an installer for the 64-bit version... 44 | msg_44=Finding an installer for the 32-bit version... 45 | msg_45=Found installer line: 46 | msg_46=The installer for your system could not be found. 47 | msg_47=Installer found: 48 | msg_48=Downloading the installer... 49 | msg_49=Ghostscript installer has been downloaded successfully. 50 | msg_50=Ghostscript installer has been launched successfully. 51 | msg_51=Downloading the installer failed. 52 | msg_52=Checking the installation... 53 | copyright_link=https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md 54 | ghostscript_link=https://ghostscript.com/releases/gsdnld.html 55 | ghostscript_altlink=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases 56 | ghostscript_release_link=https://api.github.com/repos/ArtifexSoftware/ghostpdl-downloads/releases/latest 57 | culture=en-US 58 | interface_lang=Interface language: English 59 | error_separator=---------------------------------------------------------------- 60 | short_separator=----------------------------------------------- 61 | long_separator=------------------------------------------------------------------ 62 | double_separator=================================================================== -------------------------------------------------------------------------------- /installer.iss: -------------------------------------------------------------------------------- 1 | #define MyAppName "Batch PDF Compressor" 2 | #define MyAppVersion "1.7" 3 | #define MyAppPublisher "Serhii I. Myshko" 4 | #define MyAppURL "https://github.com/sergeiown/batch_PDF_compressor" 5 | #define MyAppExeName "batch_PDF_compressor.bat" 6 | 7 | [Setup] 8 | AppId={{E714ADFC-E269-465D-9ED7-B54959018F8E} 9 | AppName={#MyAppName} 10 | AppVersion={#MyAppVersion} 11 | AppPublisher={#MyAppPublisher} 12 | AppPublisherURL={#MyAppURL} 13 | AppSupportURL={#MyAppURL} 14 | AppUpdatesURL={#MyAppURL} 15 | DefaultDirName={userdocs}\batch_PDF_compressor 16 | DefaultGroupName=Batch PDF compressor 17 | AllowNoIcons=yes 18 | LicenseFile=LICENSE.md 19 | InfoAfterFile=infoafter.txt 20 | OutputBaseFilename=batch_PDF_compressor_install 21 | SetupIconFile=batch_PDF_compressor.ico 22 | Compression=lzma 23 | SolidCompression=yes 24 | WizardStyle=classic 25 | PrivilegesRequired=lowest 26 | 27 | [Languages] 28 | Name: "english"; MessagesFile: "compiler:Default.isl" 29 | Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" 30 | Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl" 31 | 32 | [Tasks] 33 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 34 | 35 | [Files] 36 | Source: "batch_PDF_compressor.bat"; DestDir: "{app}"; Flags: ignoreversion 37 | Source: "batch_PDF_compressor.ico"; DestDir: "{app}"; Flags: ignoreversion 38 | Source: "modules\compression.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 39 | Source: "modules\date_time.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 40 | Source: "modules\directory.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 41 | Source: "modules\ghostscript.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 42 | Source: "modules\information.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 43 | Source: "modules\installer.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 44 | Source: "modules\language.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 45 | Source: "modules\options.bat"; DestDir: "{app}\modules"; Flags: ignoreversion 46 | Source: "messages\messages_english.txt"; DestDir: "{app}\messages"; Flags: ignoreversion 47 | Source: "messages\messages_russian.txt"; DestDir: "{app}\messages"; Flags: ignoreversion 48 | Source: "messages\messages_ukrainian.txt"; DestDir: "{app}\messages"; Flags: ignoreversion 49 | Source: "tests\language_manual.bat"; DestDir: "{app}\tests"; Flags: ignoreversion 50 | 51 | [Icons] 52 | Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\batch_PDF_compressor.ico" 53 | Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" 54 | Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" 55 | 56 | Name: "{userstartmenu}\Batch PDF compressor\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\batch_PDF_compressor.ico" 57 | Name: "{userstartmenu}\Batch PDF compressor\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" 58 | 59 | Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\batch_PDF_compressor.ico"; Tasks: desktopicon 60 | 61 | [Uninstall] 62 | DisplayName={#MyAppName} 63 | AppId={{E714ADFC-E269-465D-9ED7-B54959018F8E} 64 | AppName={#MyAppName} 65 | AppVersion={#MyAppVersion} 66 | UninstallDisplayIcon={app}\batch_PDF_compressor.ico 67 | UninstallString="{app}\{#MyAppExeName}" /uninstall 68 | -------------------------------------------------------------------------------- /batch_PDF_compressor.bat: -------------------------------------------------------------------------------- 1 | @REM ======================================================================== 2 | @REM Batch PDF Compressor 3 | @REM A Windows batch script for compressing PDF files using Ghostscript. 4 | @REM [Ghostscript](https://www.ghostscript.com/) 5 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 6 | @REM ======================================================================== 7 | 8 | @echo off 9 | title Batch PDF Compressor 10 | color 1F 11 | 12 | @REM ======================================================================== 13 | @REM Initialize log file and start time 14 | @REM ======================================================================== 15 | set "outputFile=%USERPROFILE%\documents\batch_PDF_compressor.log" 16 | call modules/date_time.bat 17 | 18 | echo Start time: %day%.%month%.%year% %hour%:%minute%:%second% > %outputFile% 19 | echo. >> %outputFile% 20 | echo Log file path: %outputFile% >> %outputFile% 21 | echo. >> %outputFile% 22 | 23 | @REM ======================================================================== 24 | @REM Language Selection 25 | @REM ======================================================================== 26 | call modules/language.bat 27 | 28 | @REM Test script with manual language selection 29 | @REM Uncomment the line below to enable manual language testing 30 | @REM call tests/language_manual.bat 31 | 32 | @REM ======================================================================== 33 | @REM Ghostscript Module - Check if Ghostscript is available | install 34 | @REM ======================================================================== 35 | setlocal enabledelayedexpansion 36 | call modules/ghostscript.bat 37 | if "%exitScript%"=="1" (exit /b) 38 | 39 | @REM ======================================================================== 40 | @REM Directory Setup 41 | @REM ======================================================================== 42 | call modules/directory.bat 43 | if "%exitScript%"=="1" (exit /b) 44 | 45 | @REM ======================================================================== 46 | @REM Compression Options Setup 47 | @REM ======================================================================== 48 | call modules/options.bat 49 | 50 | @REM ======================================================================== 51 | @REM PDF Compression Execution 52 | @REM ======================================================================== 53 | call modules/compression.bat 54 | 55 | @REM ======================================================================== 56 | @REM Post-Processing Information Display 57 | @REM ======================================================================== 58 | call modules/information.bat 59 | 60 | @REM ======================================================================== 61 | @REM Log the finish time and copyright information 62 | @REM ======================================================================== 63 | call modules/date_time.bat 64 | 65 | echo. >> %outputFile% 66 | echo Finish time: %day%.%month%.%year% %hour%:%minute%:%second% >> %outputFile% 67 | echo. & echo. >> %outputFile% 68 | echo Log file: %outputFile% 69 | echo. & echo. >> %outputFile% 70 | echo Copyright (c) 2025 Serhii I. Myshko 71 | echo %copyright_link% >> %outputFile% 72 | echo. & echo. >> %outputFile% 73 | 74 | @REM ======================================================================== 75 | @REM End of script 76 | @REM ======================================================================== 77 | pause 78 | exit -------------------------------------------------------------------------------- /modules/compression.bat: -------------------------------------------------------------------------------- 1 | @REM [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 2 | 3 | @echo off 4 | 5 | set /A "filecount=0" 6 | set /A "initialSize=0" 7 | if not defined directory set "directory=%CD%" 8 | 9 | for /R "%directory%" %%F in (*.pdf) do ( 10 | set /A "filecount+=1" 11 | for %%A in ("%%F") do set /A "initialSize+=%%~zA" 12 | ) 13 | 14 | set /A "progress=0" 15 | set /A "progress_compression=0" 16 | set /A "progress_already_compressed=0" 17 | set /A "progress_error=0" 18 | 19 | for /R "%directory%" %%F in (*.pdf) do ( 20 | set "input=%%F" 21 | set "output=%%~dpF%%~nF_compressed.pdf" 22 | echo. & echo. >> %outputFile% 23 | echo %%~nF | find /i "_compressed" >nul 24 | 25 | if not errorlevel 1 ( 26 | cls 27 | set /A "progress+=1" 28 | set /A "progress_already_compressed+=1" 29 | if defined filecount ( 30 | set /A "progress_percentage=(progress * 100) / filecount" 31 | ) else ( 32 | set "progress_percentage=0" 33 | ) 34 | echo %msg_13% !progress_percentage!%% & echo %msg_13% !progress_percentage!%% >> %outputFile% 35 | echo %msg_11% %%F & echo %msg_11% %%F >> %outputFile% 36 | echo %msg_12% & echo %msg_12% >> %outputFile% 37 | ) else ( 38 | cls 39 | set /A "progress+=1" 40 | if defined filecount ( 41 | set /A "progress_percentage=(progress * 100) / filecount" 42 | ) else ( 43 | set "progress_percentage=0" 44 | ) 45 | echo %msg_13% !progress_percentage!%% & echo %msg_13% !progress_percentage!%% >> %outputFile% 46 | echo %msg_14% %%F & echo %msg_14% %%F >> %outputFile% 47 | 48 | if not defined gsExecutable ( 49 | echo Error: Ghostscript executable not found & echo Error: Ghostscript executable not found >> %outputFile% 50 | set /A "progress_error+=1" 51 | ) else ( 52 | "%gsExecutable%" -sDEVICE=pdfwrite -dPDFSETTINGS=!pdfsettings! -dNOPAUSE -dQUIET -dBATCH -sOutputFile="!output!" "!input!" >> %outputFile% 2>&1 53 | 54 | if %errorlevel% neq 0 ( 55 | echo %msg_17% & echo %msg_17% >> %outputFile% 56 | set /A "progress_error+=1" 57 | ) else ( 58 | if exist "!output!" ( 59 | for %%A in ("!output!") do set /A "compressedSize=%%~zA" 60 | if defined compressedSize ( 61 | if !compressedSize! LSS 5120 ( 62 | echo %msg_15% & echo %msg_15% >> %outputFile% 63 | set /A "progress_error+=1" 64 | del "!output!" 65 | ) else ( 66 | if "%delete_originals%"=="1" ( 67 | echo %msg_16% & echo %msg_16% >> %outputFile% 68 | set /A "progress_compression+=1" 69 | del "!input!" 70 | ) else ( 71 | echo %msg_34% & echo %msg_34% >> %outputFile% 72 | set /A "progress_compression+=1" 73 | ) 74 | ) 75 | ) 76 | ) else ( 77 | echo %msg_17% & echo %msg_17% >> %outputFile% 78 | set /A "progress_error+=1" 79 | ) 80 | ) 81 | ) 82 | ) 83 | ) 84 | echo. & echo. >> %outputFile% 85 | 86 | set /A "compressedSize=0" 87 | 88 | for /R "%directory%" %%F in (*.pdf) do ( 89 | set "filename=%%~nF" 90 | set "extension=%%~xF" 91 | set "compressedPair=!filename!_compressed!extension!" 92 | 93 | if "!filename:~-10!"=="_compressed" ( 94 | for %%A in ("%%F") do set /A "compressedSize+=%%~zA" 95 | ) else ( 96 | if not exist "!directory!\!compressedPair!" ( 97 | for %%A in ("%%F") do set /A "compressedSize+=%%~zA" 98 | ) 99 | ) 100 | ) 101 | 102 | if not defined initialSize set "initialSize=0" 103 | if not defined compressedSize set "compressedSize=0" 104 | 105 | set /A "initialSizeKB=(initialSize + 512) / 1024" 106 | set /A "compressedSizeKB=(compressedSize + 512) / 1024" 107 | 108 | if %initialSizeKB% gtr 0 ( 109 | set /A "compressionRatio=((initialSizeKB-compressedSizeKB)*(-100))/initialSizeKB" 110 | ) else ( 111 | set "compressionRatio=%msg_29%" 112 | ) 113 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [Batch PDF compressor](https://github.com/sergeiown/batch_PDF_compressor/releases) 2 | [![batch_PDF_compressor](https://github.com/user-attachments/assets/a7ba8320-69a0-4dae-9dbf-20c98220777c)](https://github.com/sergeiown/batch_PDF_compressor/releases) 3 | 4 | - [Structure](#structure) 5 | 6 | - [Requirements](#requirements) 7 | 8 | - [Script Functionality](#script-functionality) 9 | 10 | - [Usage](#usage) 11 | 12 | - [License](#license) 13 | 14 | | This Windows batch processing script provides an efficient way to compress PDF files using different compression levels and options. It utilizes the [Ghostscript](https://www.ghostscript.com/) to perform operations on PDF files. The main purpose is to conveniently batch compress all PDF files in the selected directory as well as in all subdirectories. | ![image](https://github.com/sergeiown/batch_PDF_compressor/assets/112722061/4023a1b7-5b51-4f55-91a6-7b34245f0af4) | 15 | | :--- | ---: | 16 | 17 | ### [Structure](#batch-pdf-compressor) 18 | 19 | ```mermaid 20 | graph RL; 21 | style A font-weight:bold; 22 | A[batch_PDF_compressor] 23 | 24 | A -->|call| B1[date_time] 25 | A -->|call| B2[ghostscript] 26 | A -->|call| B3[directory] 27 | A -->|call| B4[options] 28 | A -->|call| B5[compression] 29 | A -->|call| B6[language] 30 | A -->|call| B7[information] 31 | A -->|optional_call| Tests 32 | 33 | subgraph Modules 34 | B1[date_time] 35 | B2[ghostscript] 36 | B3[directory] 37 | B4[options] 38 | B5[compression] 39 | B6[language] 40 | B7[information] 41 | B2 -->|call| B8[installer] 42 | end 43 | 44 | subgraph Tests 45 | C1[language_manual] 46 | end 47 | 48 | subgraph Messages 49 | D1[messages_english] 50 | D2[messages_ukrainian] 51 | D3[messages_russian] 52 | end 53 | 54 | B6 -->|data reading| D1 55 | B6 -->|data reading| D2 56 | B6 -->|data reading| D3 57 | C1 -->|data reading| D1 58 | C1 -->|data reading| D2 59 | C1 -->|data reading| D3 60 | ``` 61 | 62 | ### [Requirements](#batch-pdf-compressor) 63 | 64 | 1. **Windows-based system.\*** 65 | 2. **[Ghostscript](https://www.ghostscript.com/).\*\*** 66 | 67 | | \* \- *Tested on Windows 10 and Windows 11 operating systems, both x86 and x64 architectures. The scripts have not been tested on earlier versions.* | [![windows_compatibility](https://github.com/user-attachments/assets/db2b5487-b5bf-45d9-8948-48bb88162f17)](https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions) | 68 | | :--- | :---: | 69 | 70 | | \* \- *If [Ghostscript](https://www.ghostscript.com/) is not installed, the latest release will be detected and offered to install when Batch PDF Compressor is launched.* | ![image](https://github.com/sergeiown/batch_PDF_compressor/assets/112722061/ed8ea024-9edf-43b4-829b-925daa2c9071) | 71 | | :--- | :---: | 72 | 73 | ### [Script Functionality](#batch-pdf-compressor) 74 | 75 | The script offers the following features: 76 | 77 | 1. Automatic selection of English, Ukrainian, or Russian according to the system language using universal UTF-8 (support for external message files has been added). 78 | 2. Selection the path to the directory with PDF files to be compressed using the windows.Forms.FolderBrowserDialog. With path validation and allowance for 3 false addresses or bounces. 79 | 3. Selection of compression level: low, medium, high, ultra. 80 | 4. Choose to delete or save original PDF files. 81 | 5. The script processes all PDF files within the specified directory and its subdirectories. 82 | 6. Displays progress of file processing and compression. 83 | 7. Upon completion, provides an overview of script execution, including the number of processed files, sizes before and after compression, and the compression ratio. 84 | 8. Additionally, the script checks the system for the presence of Ghostscript before execution and maintains a detailed log file for each compression operation. 85 | 86 | | ![image](https://github.com/sergeiown/batch_PDF_compressor/assets/112722061/d01cc59a-68e3-40ae-acbd-68d9529d07ec) | ![image](https://github.com/sergeiown/batch_PDF_compressor/assets/112722061/8c874426-ffab-4d7e-8749-0e70e52fbdb2) | 87 | | :---: | :---: | 88 | 89 | ### [Usage](#batch-pdf-compressor) 90 | 91 | 1. **[Use the executable installer](https://github.com/sergeiown/batch_PDF_compressor/releases)** *(best practice)* or clone the project and run the `batch_PDF_compressor.bat` script *(If you are using a batch script, make sure that the text files with messages are available in the `/messages` directory and the modules are available in the `/modules` directory)*. 92 | 2. The required language will be selected automatically according to the system settings. 93 | 3. Select the directory containing the PDF files you want to compress. The script will "look" at the lower levels and process the PDFs in the subdirectories on its own. 94 | 4. Select the compression level (1-4) corresponding to the provided options. 95 | 5. Choose whether to delete or keep the original PDF files. 96 | 6. After completion you can find the a log file containing information about processed files and compression results at `%UserProfile%\Documents` with the name `batch_PDF_compressor.log`. 97 | 98 | ### [License](#batch-pdf-compressor) 99 | 100 | [Copyright (c) 2023 - 2025 Serhii I. Myshko](https://github.com/sergeiown/compress_PDF/blob/main/LICENSE.md) 101 | --------------------------------------------------------------------------------