A Python-based GUI application that allows you to visually select rectangular regions in PDF files and extract text from those regions.
- 📄 Open and view PDF files
- 🔍 Zoom in/out for better precision
- ✏️ Draw rectangles to select text regions
- 📝 Extract text from selected regions
- 🖱️ Simple and intuitive mouse-based interface
- 📑 Navigate through multi-page PDFs
- Python 3.8 or higher
- PyMuPDF (fitz)
- Pillow
- tkinter (usually comes with Python)
- Clone or download this repository:
git clone <repository-url>
cd pdf-rectangle-selection-tool- Install the required dependencies:
pip install -r requirements.txt- Run the application:
python main.py-
Click "Open PDF" to load a PDF file
-
Use the mouse to draw rectangles around text you want to extract:
- Click and hold the left mouse button
- Drag to create a rectangle
- Release to finalize the selection
-
Click "Extract Text" to extract text from all selected regions
-
The extracted text will appear in the right panel
- Open PDF: Load a PDF file
- Previous/Next Page: Navigate through pages
- Zoom In/Out: Adjust the zoom level
- Reset Zoom: Return to 100% zoom
- Extract Text: Extract text from selected rectangles
- Clear Selection: Remove all selected rectangles
- Use zoom to select text more precisely
- Multiple rectangles can be selected before extraction
- Rectangles are cleared when changing pages
- Text extraction quality depends on the PDF's text layer
If you encounter any issues:
- Ensure all dependencies are installed correctly
- Make sure the PDF file is not corrupted
- Try adjusting the zoom level for better selection accuracy
Contributions are welcome! Please feel free to submit issues or pull requests.