🎯 Vấn đề cần giải quyết
PDF scan có trang bị ngược? Mix trang dọc và ngang? Một số trang cần xoay để đọc?
Pain points:
- Đọc file cổ xoay đầu
- Print ra bị lệch hướng
- Khó share file bị ngược
⚖️ So sánh: Trước và Sau
| Tiêu chí | Thủ công | Agentic Workflow |
|---|---|---|
| Thời gian/file | 5-10 phút | 30 giây |
| Accuracy | Manual check | Consistent |
| Batch | Không | Có |
💡 Prompt mẫu
Xoay trang PDF:
INPUT: [file PDF]
ROTATION:
- All pages: 90° CW / 90° CCW / 180°
- Specific pages: page 3, 5-10 rotate 90° CW
- Auto-detect: xoay trang landscape về portrait
OPTIONS:
- Preserve: bookmarks, links, annotations
- Permanent rotation (modify page)
OUTPUT:
- Suffix: _rotated
- Hoặc overwrite original
🏗️ Phase 2: Architect (Permanent Tool)
For Administrative Staff.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "PDF Rotator Station" Desktop App
**Objective:** A graphical tool to correct page orientation in mixed-source documents.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* PDF Engine: pypdf
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** Source PDF.
* **View:** Thumbnail grid of pages.
* **Action:** Click thumbnail to rotate 90°.
* **Bulk:** "Rotate All Left/Right" buttons.
* **Save:** "Save Changes".
2. **Core Logic:**
* Render thumbnails for preview.
* Track rotation state (0, 90, 180, 270).
* Apply transforms to PDF Writer.
* **Threading:** Thumbnail generation 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
Rotation options
| Rotation | Use case |
|---|---|
| 90° CW | Portrait → Landscape |
| 90° CCW | Landscape → Portrait |
| 180° | Upside down pages |
| Auto | Mixed orientation |
Common scenarios
- Scanned docs: Often upside down
- Mixed orientation: Tables in landscape
- Legal docs: Landscape charts
Batch processing
- Apply same rotation to all
- Specify per-page rotations
- Auto-detect and correct
Độ khó: ⭐ Beginner | Thời gian: 2 phút