📄

Protect PDF

Thêm password, restrict printing/copying/editing cho file PDF.

PDF ⭐ Beginner ⏱️ 2 phút

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

Gửi hợp đồng PDF cần bảo mật? Muốn share tài liệu nhưng không cho copy text? Cần ngăn người khác print?

Pain points:

  • File nhạy cảm dễ bị forward
  • Không kiểm soát được ai đọc
  • Nội dung bị copy/paste

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

Tiêu chíKhông bảo vệCó password
Ai cũng mở đượcKhông
Copy textBlock được
PrintBlock được

💡 Prompt mẫu

Bảo vệ file PDF:

INPUT: [file PDF]

PASSWORD PROTECTION:
- Open password: [password để mở]
- Permission password: [password để thay đổi settings]

RESTRICTIONS:
- Printing: Không cho / Low quality only
- Copying text: Không cho
- Editing: Không cho
- Commenting: Cho phép
- Form filling: Cho phép

ENCRYPTION:
- Level: AES-256 (recommended)

OUTPUT:
- Suffix: _protected

🏗️ Phase 2: Architect (Permanent Tool)

For Security Officers.

Engineering Prompt:

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

**Objective:** A security tool to apply encryption and permission restrictions to PDFs.

**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Crypto: pikepdf (QPDF wrapper) for strong encryption
* Packaging: PyInstaller

**Functional Requirements:**
1.  **UI Layout (PyQt6):**
    *   **Input:** File/Folder List.
    *   **Credentials:** Fields for "User Password" and "Owner Password".
    *   **Permissions:** Checkboxes for "Allow Printing", "Allow Copying", "Allow Modifying".
    *   **Algo:** Radio "AES-128" vs "AES-256".

2.  **Core Logic:**
    *   Iterate inputs and apply `pikepdf.save()` with encryption info.
    *   Verify password strength (UI feedback).
    *   **Threading:** Encryption 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

Two types of passwords

TypePurpose
Open passwordCần để mở file
Permission passwordCần để thay đổi restrictions

Common restrictions

  • No print: Ngăn in
  • No copy: Ngăn copy text
  • No edit: Ngăn thay đổi nội dung
  • No extract: Ngăn extract pages
  • No annotate: Ngăn comment

Security levels

LevelEncryption
LowRC4 40-bit (weak)
MediumRC4 128-bit
HighAES-128
HighestAES-256 ✓

⚠️ Limitations

  • Password có thể bị crack
  • Restrictions có thể bypass
  • Screenshot vẫn hoạt động

Độ khó: ⭐ Beginner | Thời gian: 2 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.