Simple tool to mark/add highlights to pdf documents.
Project description
pdfmarker
Simple PDF marker written in Python. Based on the PyMuPDF/fitz library.
Features
Highlight text in pdf files using this very simple utility. The very unclear and untyped PyMuPDF API motivated me to write this package.
Installation
pip install pdfmarker
Usage
Using pdfmarker takes 3 simple steps:
- Read a file into a
Marker
object using:Marker.from_disk()
: A file stored on disk.Marker.from_bytes()
: A bytes object in memory. E.g. a downloaded pdf.
- Add words/phrases to be highlighted.
marker.add(Highlight("Example"))
- Supports default and custom colors.
- Supports subwords.
- Supports grouping. Useful when highlighting topics/themes with different colors in one document. This adds a legend to the top of each page.
- Mark & save using:
Marker.to_disk()
: Write to disk.Marker.to_bytes()
: Returns the modified pdf as bytes object.
from pdfmarker import Colors, Highlight, Marker
marker = Marker.from_disk(path="tests/data/test.pdf")
marker.add(
[Highlight("Sample", group="test"), Highlight("con", group="test", color=Colors.red, subwords=True)]
)
marker.add(Highlight("simple", group="max"))
marker.to_disk("example_marked.pdf")
To-do
- Add codecov
Contributing
Contributions are welcome! If you would like to contribute to pdfmarker, please follow these steps:
- Fork the repository on GitHub. https://github.com/TomUijtdehaag/pdfmarker
- Clone your forked repository to your local machine.
- Create a new branch for your changes.
- Make your changes and commit them with descriptive commit messages.
- Push your changes to your forked repository.
- Submit a pull request to the main repository.
Please ensure that your code follows the project's coding conventions and includes appropriate tests. Also, provide a clear description of the changes you have made in your pull request.
Thank you for contributing to pdfmarker!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pdfmarker-0.2.0.tar.gz
.
File metadata
- Download URL: pdfmarker-0.2.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81694011692e659816962567acb9679700be3288f7270d397a2934a6a8eb5029 |
|
MD5 | df4cd57061b8f59ac724389f4173b4b4 |
|
BLAKE2b-256 | 50d821fca184cf3e94f2a3a154b133ccb4f1237422abb9dc0b1af8893da3d7ba |
File details
Details for the file pdfmarker-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pdfmarker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddf1d7c87f47aca196ebada6206a89c6714b785536f266b0c14ee40b2d170172 |
|
MD5 | aa0ac1e57ec03256d5ac04dfaeb7cc44 |
|
BLAKE2b-256 | f40614db66631abd5bb6ae471582791a3b4f82220d3e55ba4aff2874319c5ed4 |