π« The Pain Point
You need to share a PDF page on Instagram or include it in a presentation. But you canβt embed PDFs directly - you need images.
π Agentic Solution
A PDF to Image Converter with customizable resolution and format options.
Key Features:
- High DPI: Export at 300 DPI for print quality.
- Format Options: PNG (lossless) or JPG (smaller file size).
- Batch Processing: Convert entire folders of PDFs.
βοΈ Phase 1: Commander (Quick Fix)
For quick conversion.
Prompt:
βI have a PDF
document.pdf. Write a Python script using pdf2image to:
- Convert: All pages to PNG images.
- DPI: 200 DPI (adjustable).
- Output: Save as
page_001.png,page_002.png, etc.Print progress (e.g., βConverting page 1/20β). Handle corrupt PDFs gracefully.β
Result: High-quality images of each page.
ποΈ Phase 2: Architect (Permanent Tool)
For Content Creators.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "PDF to Image Converter" Desktop App
**Objective:** A high-quality rasterizer to convert PDF pages into PNG/JPG images.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Image Engine: pdf2image (Poppler wrapper)
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** File/Folder Selector.
* **Settings:** DPI Slider (72 - 300), Format Dropdown (JPG/PNG).
* **Quality:** JPG Quality Slider.
* **Output:** Destination Folder.
2. **Core Logic:**
* Interface with Poppler via `pdf2image`.
* Create subfolder for each document's pages.
* **Threading:** Rendering is CPU heavy; MUST execute 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`
π§ Prompt Decoding
- DPI (Dots Per Inch): Higher = better quality but larger files. 72 for web, 300 for print.
- Poppler: A PDF rendering library required by pdf2image. Must be installed separately.
π οΈ Instructions
- Install Poppler (Windows: download binaries, Mac:
brew install poppler). - Install:
pip install pdf2image - Copy Prompt β Run.