Pre-release
This release is a pre-release and may not be stable for production use.
extract-pdf-highlighted-text
Extract text that has been highlighted in PDF documents.
How it works
- Locates all highlight annotations in each page using PyPDF2.
- Computes the bounding boxes of each highlight annotation.
- Uses pdfminer.six to determine locations of all visible characters on the page.
- For each annotation, matches the characters whose bounding boxes overlap the annotation's bounding box (using IoU).
- Groups and prints out the highlighted text in reading order.
Installation
pip install extract-pdf-highlighted-text
After installation, run it as extract_pdf_highlighted_text.
Dependencies:
- PyPDF2 (for annotation geometry)
- pdfminer.six (for text locations)
Usage
extract_pdf_highlighted_text your_file.pdf
The script will print each extracted highlight in reading order.
Example Output
This is a highlighted passage.
Another highlighted bit here.
Limitations
- Does not support image-based PDFs (no OCR).
- Precision may depend on PDF quality and producer.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Release files for extract-pdf-highlighted-text 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| extract_pdf_highlighted_text-0.1.0a1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| extract_pdf_highlighted_text-0.1.0a1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 10.1 kB
Release files / extract_pdf_highlighted_text-0.1.0a1.tar.gz
| Download URL | extract_pdf_highlighted_text-0.1.0a1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23aa3645f77ff07d155c2a53810c5f044d8734409fc2994e49d4ffe81697bd0c
|
|
BLAKE2b-256 checksum How to use checksums |
d890b620d0e3c9c2a7a08718f8c36d876d3d6cd54a924ac2755fcd40dc1a3354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / extract_pdf_highlighted_text-0.1.0a1-py2.py3-none-any.whl
| Download URL | extract_pdf_highlighted_text-0.1.0a1-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
29735eec2c0b2e36ee013245e38dfe7bcfd583aad794b7c4ad075142adb5ea15
|
|
BLAKE2b-256 checksum How to use checksums |
c0d9979723818c263b8be93c5db607fdb8063175c684fbc86247484b0576ae5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|