A user-friendly desktop application for compressing PDF files while maintaining reasonable quality. Built with Python and Tkinter.
- Simple and intuitive graphical user interface
- Multiple compression quality options:
- Screen (Maximum compression, ~60-90% reduction)
- Ebook (Good compression, ~50-80% reduction)
- Printer (Medium compression, ~30-50% reduction)
- Prepress (High quality, ~10-30% reduction)
- Automatic file naming to prevent overwriting existing files
- Real-time compression progress indicator
- Detailed compression results showing original and final sizes
- Windows Operating System
- Python 3.6 or higher
- Ghostscript (included in the release package)
- Required Python packages:
tkinter (usually comes with Python)
- Download the latest release from the Releases page
- Extract the ZIP file
- Run
PDF-Compressor.exe
-
Clone this repository:
git clone https://github.com/yourusername/PDF-Compressor.git
-
Navigate to the project directory:
cd PDF-Compressor -
Install Ghostscript:
- Download from Ghostscript official website
- Install and ensure it's in your system PATH, or
- Place the required files (
gswin64c.exeandgsdll64.dll) in thegs/binfolder
-
Run the application:
python pdf_compressor.py
- Launch the application
- Click "Browse" to select your PDF file
- Choose your desired compression quality:
- Screen: Best for viewing on screen, highest compression
- Ebook: Good for e-readers, balanced compression
- Printer: Suitable for regular printing
- Prepress: High quality, minimal compression
- Click "Compress PDF"
- Wait for the compression to complete
- The compressed file will be saved with "_compressed" suffix in the same directory
- Compressed files are automatically named with the suffix "_compressed"
- If a file with the same name exists, a number is added (e.g.,
document_compressed_1.pdf)
-
"Ghostscript files not found" error
- Ensure Ghostscript is properly installed
- Check if
gswin64c.exeandgsdll64.dllare present in thegs/binfolder
-
Application won't start
- Verify Python is installed correctly
- Ensure all dependencies are met
- Check if you have sufficient permissions
-
Compression fails
- Verify the input PDF is not corrupted
- Ensure you have write permissions in the output directory
- Check if the PDF is not password-protected
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built using Ghostscript for PDF compression
- Icon and UI design by SPK
SPK - [GitHub Profile] (https://github.com/parvez144)
- Python 3.x installed
- Required Python packages:
- PyInstaller
- Ghostscript (system dependency)
pip install -r requirements.txt-
Create the spec file:
pyi-makespec --onefile --windowed --icon=spk.ico pdf_compressor.py
-
Edit the spec file to include Ghostscript:
- Add Ghostscript binaries to the binaries list
- Add the icon file to the datas list
-
Build the executable:
pyinstaller pdf_compressor.spec
-
Verify the executable:
- Check
dist/PDF_Compressor.exe - Test the executable
- Ensure Ghostscript is working
- Check
-
Install Inno Setup (Download from: https://jrsoftware.org/isdl.php)
-
Prepare your files:
dist/PDF_Compressor.exe(PyInstaller executable)spk.ico(Application icon)setup.iss(Inno Setup script)
-
Open Inno Setup Compiler:
- Launch Inno Setup Compiler
- Open the
setup.issfile - Click "Compile" (or press F9)
- The setup file will be created in the
Outputfolder
-
Verify the setup:
- Test the setup on your computer
- Check all functionality
- Ensure proper Windows integration
- If executable doesn't run, check Ghostscript inclusion
- If size is too large, check for unnecessary files
- If antivirus triggers, verify the build process
- If setup creation fails, verify all required files exist
- If setup size is too large, check PyInstaller executable size
- Ensure proper file paths in setup.iss