📄

Add Page Numbers

Đánh số trang, thêm header/footer vào file PDF.

PDF ⭐ Beginner ⏱️ 3 phút

🎯 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ố trangCó số trang
NavigationKhóDễ
ReferenceKhông chính xác”See page 15”
ProfessionalKémTố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

PositionUse case
Bottom centerMost common
Bottom rightBooks
Top rightReports
Bottom outsideDouble-sided print

Number formats

  • 1, 2, 3 - Simple
  • Page 1 of 10 - With total
  • i, 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

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.