🎯 Vấn đề cần giải quyết
Có 100 form PDF giống nhau cần điền cho 100 khách hàng? Form đăng ký cần điền hàng loạt? Hợp đồng template với thông tin khác nhau?
Pain points:
- Điền từng form rất chậm
- Dễ sai sót khi điền nhiều
- Copy-paste tên/địa chỉ nhàm chán
⚖️ So sánh: Trước và Sau
| Tiêu chí | Thủ công | Agentic Workflow |
|---|---|---|
| Thời gian/form | 5-10 phút | 5 giây |
| Errors | Thường xảy ra | 0 |
| Scale | 10 forms/giờ | 1000+/giờ |
💡 Prompt mẫu
Điền PDF forms tự động:
INPUT:
- PDF form template: [file]
- Data source: Excel/CSV với columns:
- name, address, phone, email, date, ...
FIELD MAPPING:
- "Full Name" field → name column
- "Address" field → address column
- "Date" field → current date
- "Signature" → [image file]
OUTPUT:
- One PDF per row
- Naming: form_{name}.pdf
- Flatten form: Có (không edit được)
🏗️ Phase 2: Architect (Permanent Tool)
For Admin/HR Ops.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Bulk Form Filler" Desktop App
**Objective:** A batch automation tool to merge Excel data into fillable PDF templates.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* PDF Engine: pdfrw / pypdf
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Template:** Select PDF Form.
* **Data:** Select Excel/CSV.
* **Mapper:** Grid UI to map "Excel Header" -> "PDF Field Name".
* **Options:** Checkbox "Flatten Result" (Read-only).
* **Action:** "Generate Batch".
2. **Core Logic:**
* Parse PDF annotations to find field keys.
* Dictionary string replacement.
* Handle UTF-8 font embedding for non-ASCII characters.
* **Threading:** File IO in background thread.
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
Form types
| Type | Fill method |
|---|---|
| AcroForm | Native support |
| XFA form | Limited support |
| Static PDF | Overlay text |
Data preparation
- Clean data trước (trim spaces)
- Standardize date formats
- Validate phone/email
- Check field length limits
Advanced features
- Digital signature insertion
- Checkbox/radio button
- Dropdown selection
- Date picker
Độ khó: ⭐⭐ Intermediate | Thời gian: 10 phút