📄

Compress PDF

Giảm file size PDF tới 80% mà vẫn giữ chất lượng đọc được.

PDF ⭐ Beginner ⏱️ 3 phút

🎯 Vấn đề cần giải quyết

PDF 50MB không gửi được qua email (giới hạn 25MB)? Upload lên hệ thống bị reject vì quá lớn? Website load chậm vì PDF nặng?

Pain points:

  • File quá lớn để share
  • Upload bị timeout
  • Storage đầy nhanh

⚖️ So sánh: Trước và Sau

Tiêu chíOriginalCompressed
File size50MB5-10MB
QualityMaxStill readable
Email friendlyKhông

💡 Prompt mẫu

Nén file PDF:

INPUT: [file PDF lớn]

COMPRESSION LEVEL:
- Low: giữ chất lượng cao (giảm 30-40%)
- Medium: balanced (giảm 50-60%)
- High: tối ưu size (giảm 70-80%)

OPTIMIZE:
- Downscale images: 150 DPI (đủ cho màn hình)
- Remove metadata: Có
- Flatten forms: Tùy chọn
- Subset fonts: Có

TARGET:
- Max file size: 10MB
- Hoặc compression ratio: 70%

OUTPUT:
- Suffix: _compressed
- Report: before/after size

🏗️ Phase 2: Architect (Permanent Tool)

For IT/Archiving Teams.

Engineering Prompt:

**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "PDF Optimizer" Desktop App

**Objective:** A compression utility to reduce PDF file size while maintaining readability.

**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Engine: Ghostscript (via subprocess) or pypdf (limited)
* Packaging: PyInstaller

**Functional Requirements:**
1.  **UI Layout (PyQt6):**
    *   **Input:** File/Folder List.
    *   **Profile:** Dropdown "Screen (72dpi)", "Ebook (150dpi)", "Print (300dpi)".
    *   **Stats:** Table showing "Original Size" vs "Compressed Size" (Real-time update).
    *   **Action:** "Compress All".

2.  **Core Logic:**
    *   Interface with `Ghostscript` binary for high-efficiency compression.
    *   Alternative: Downsample images using `pikepdf`.
    *   **Threading:** Compression is CPU intensive; runs in background.

3.  **Deliverables:**
    *   `main.py`: Complete source code.
    *   `requirements.txt`: Dependencies.
    *   **Build Instructions:**
        *   Windows: `pyinstaller --onefile --noconsole main.py`
        *   macOS: `pyinstaller --windowed --noconsole main.py`

🔧 Tips & Best Practices

What takes space in PDF?

Content% SizeCompress?
Images80-90%Yes, main target
Fonts5-15%Subset
Text1-5%Already small
Metadata1%Remove

DPI guidelines

PurposeDPI
Screen only72-100
Print home150
Print professional300

Quality presets

  • Screen: Smallest, 72dpi, web viewing
  • eBook: Small, 150dpi, tablets
  • Print: Large, 300dpi, professional

Độ khó: ⭐ Beginner | Thời gian: 3 phút

Related Workflows

Explore other categories

📬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

📖 Free eBook Guide 📦 7 Ready-to-use Scripts 🔔 Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.