-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompress_pdf.bat
More file actions
32 lines (28 loc) Β· 814 Bytes
/
compress_pdf.bat
File metadata and controls
32 lines (28 loc) Β· 814 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
29
30
31
32
@echo off
REM PDF Compressor Script using Ghostscript
REM Author: Enya Elvis
REM Check if input and output are provided
if "%~1"=="" (
echo β Please provide the input PDF file path.
echo Example: compress_pdf.bat input.pdf output.pdf
exit /b
)
if "%~2"=="" (
echo β Please provide the output PDF file path.
echo Example: compress_pdf.bat input.pdf output.pdf
exit /b
)
REM Run Ghostscript compression
gswin32c ^
-sDEVICE=pdfwrite ^
-dCompatibilityLevel=1.4 ^
-dPDFSETTINGS=/screen ^
-dDownsampleColorImages=true ^
-dColorImageResolution=90 ^
-dDownsampleGrayImages=true ^
-dGrayImageResolution=90 ^
-dDownsampleMonoImages=true ^
-dMonoImageResolution=90 ^
-dNOPAUSE -dQUIET -dBATCH ^
-sOutputFile="%~2" "%~1"
echo β
Compression complete! Output saved as %~2