🎯 Vấn đề cần giải quyết
PDF ghép từ nhiều file không có số trang? Cần thêm “Page X of Y” vào footer? Header với tên công ty?
Pain points:
- PDF gốc không có page numbers
- Merge nhiều file mất số trang
- Không biết đang ở trang nào khi in
⚖️ So sánh: Trước và Sau
| Tiêu chí | Không số trang | Có số trang |
|---|---|---|
| Navigation | Khó | Dễ |
| Reference | Không chính xác | ”See page 15” |
| Professional | Kém | Tốt |
💡 Prompt mẫu
Thêm số trang vào PDF:
INPUT: [file PDF]
PAGE NUMBERS:
- Format: "Page {n} of {total}" / "{n}" / "- {n} -"
- Position: bottom center / bottom right
- Start from: 1 (hoặc skip cover page)
- Font: Arial, 10pt
- Color: Gray (#666666)
HEADER (optional):
- Text: "Company Name - Confidential"
- Position: top center
MARGINS:
- From edge: 1cm
OUTPUT:
- Suffix: _numbered
🏗️ Phase 2: Architect (Permanent Tool)
For Document Managers.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "PDF Paginator Pro" Desktop App
**Objective:** A tool to batch add customizable page numbers and headers/footers to PDF documents.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* PDF Engine: PyPDF2/reportlab
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** File/Folder Selector.
* **Config:** Toggle "Page X of Y", "Simple Numbering".
* **Style:** Font Face, Size, Color, Margin Position (Top/Bottom, Left/Center/Right).
* **Output:** Suffix input (e.g., "_paged").
2. **Core Logic:**
* Generate overlay PDF with numbers using ReportLab.
* Merge overlay with source pages.
* **Threading:** Processing loop 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
Position options
| Position | Use case |
|---|---|
| Bottom center | Most common |
| Bottom right | Books |
| Top right | Reports |
| Bottom outside | Double-sided print |
Number formats
1, 2, 3- SimplePage 1 of 10- With totali, ii, iii- Roman (intro)A-1, A-2- Section prefix
Skip pages
- Skip cover page
- Skip TOC
- Different style for appendix
Độ khó: ⭐ Beginner | Thời gian: 3 phút