pdf_compressor/
├── app.py ← Flask server (sudah diupgrade)
├── pdf.py ← Logic kompresi
├── requirements.txt
├── templates/
│ └── index.html ← Frontend (terhubung ke backend)
├── uploads/ ← Auto-dibuat saat run
└── outputs/ ← Auto-dibuat saat run
pip install -r requirements.txtDownload installer dari: https://www.ghostscript.com/releases/gsdnld.html
Pastikan gswin64c tersedia di PATH.
Cek dengan:
gswin64c --versionbrew install ghostscript(Ubah gswin64c → gs di pdf.py baris pemanggilan subprocess)
sudo apt install ghostscript(Ubah gswin64c → gs di pdf.py)
cd pdf_compressor
python app.pyBuka browser: http://127.0.0.1:5000
- Drop file PDF ke area upload
- Pilih mode (AUTO direkomendasikan)
- Atur parameter sesuai kebutuhan
- Klik Run Compression
- Lihat hasil nyata, lalu klik Download
| Mode | Cocok untuk | Teknik |
|---|---|---|
| AUTO | Semua jenis PDF | Otomatis detect tipe |
| DIGITAL | PDF teks (Word, LaTeX) | GC + font subsetting (Ghostscript) |
| SCAN | PDF hasil scan | Rasterisasi ulang ke JPEG |
| HYBRID | Campuran teks + gambar | GC + font subsetting |
Ghostscript tidak ditemukan?
Jika Ghostscript belum tersedia, mode DIGITAL/HYBRID tetap jalan — hanya
step structural optimization yang aktif (tanpa font subsetting).
Import error PyMuPDF?
pip install --upgrade PyMuPDF