Skip to main content

Simple tool to mark/add highlights to pdf documents.

Project description

CI

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:

  1. 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.
  2. 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.
  3. 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

  1. Add codecov

Contributing

Contributions are welcome! If you would like to contribute to pdfmarker, please follow these steps:

  1. Fork the repository on GitHub. https://github.com/TomUijtdehaag/pdfmarker
  2. Clone your forked repository to your local machine.
  3. Create a new branch for your changes.
  4. Make your changes and commit them with descriptive commit messages.
  5. Push your changes to your forked repository.
  6. 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

pdfmarker-0.2.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

pdfmarker-0.2.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

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

Hashes for pdfmarker-0.2.0.tar.gz
Algorithm Hash digest
SHA256 81694011692e659816962567acb9679700be3288f7270d397a2934a6a8eb5029
MD5 df4cd57061b8f59ac724389f4173b4b4
BLAKE2b-256 50d821fca184cf3e94f2a3a154b133ccb4f1237422abb9dc0b1af8893da3d7ba

See more details on using hashes here.

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

Hashes for pdfmarker-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddf1d7c87f47aca196ebada6206a89c6714b785536f266b0c14ee40b2d170172
MD5 aa0ac1e57ec03256d5ac04dfaeb7cc44
BLAKE2b-256 f40614db66631abd5bb6ae471582791a3b4f82220d3e55ba4aff2874319c5ed4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page