Skip to content

Instantly share code, notes, and snippets.

View sanchit3008's full-sized avatar

Sanchit Agarwal sanchit3008

  • New Delhi
  • 09:54 (UTC +05:30)
View GitHub Profile
@sanchit3008
sanchit3008 / compress.py
Last active January 16, 2021 10:06
PDF Compression in Windows using Python and Ghostscript
import os
import time
'''
1. Download https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9533/gs9533w64.exe
2. Install Ghostscript from the exe.
3. Confirm that gswin64c.exe is present in C:\\Program Files\\gs\\gs9.53.3\\bin
4. Place this python file in a folder containing all the PDFs to be compressed.
5. Run 'python compress.py' from a command prompt (don't use powershell).
6. Compressed files will be saved in 'Compressed' subfolder.