Skip to content

Instantly share code, notes, and snippets.

@chandu
Forked from xoofx/ShrinkAllPdfs.bat
Created May 15, 2017 01:27
Show Gist options
  • Save chandu/776bea1674f528c81189eada92f41c70 to your computer and use it in GitHub Desktop.
Save chandu/776bea1674f528c81189eada92f41c70 to your computer and use it in GitHub Desktop.
Shrink all pdf files in a folder (Windows)
@echo off
REM Install Ghostscript 64bit from http://www.ghostscript.com/download/gsdnld.html
REM Shrink all pdfs files in the current directory where this script is run and output to the
REM compressed sub-folder
setlocal
set GS_BIN=C:\Program Files\gs\gs9.15\bin\gswin64c.exe
set GS_OUTPUT_DIR=compressed
mkdir %GS_OUTPUT_DIR%
for %%i in (*.pdf) do "%GS_BIN%" -dNOPAUSE -dBATCH -dSAFER -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -sDEVICE=pdfwrite -sOutputFile="%GS_OUTPUT_DIR%\%%i" "%%i"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment