Skip to main content

PyCropPDF

PyCropPDF is a desktop PDF editor for cropping pages, adding visual masks, and redacting selected content.

PyCropPDF screenshot

Install

PyCropPDF requires Python 3.10 or later.

pip install pycroppdf

For development:

git clone https://github.com/lukaszliniewicz/PyCropPDF.git
cd PyCropPDF
pip install -e ".[dev]"

Run

pycroppdf
pycroppdf --input /path/to/document.pdf

Optional arguments:

  • --save-to DIRECTORY saves to that directory instead of opening a Save dialog.
  • --save-as NAME.pdf sets the output name when used with --save-to; otherwise the default is <input>_modified.pdf.
  • --manifest-out PATH sets the JSON provenance-manifest path. By default it is saved next to the PDF as <output>.pycroppdf.json.

Edit a PDF

  1. Open a PDF with File > Open PDF... or drag it into the window.
  2. Choose an overlay view for all pages, separate odd/even pages, or a single page from the thumbnail list.
  3. Select thumbnails to limit an operation to specific pages. Use Ctrl/Cmd-click to toggle pages and Shift-click to select a range.
  4. Draw visual masks or redactions first. To make further masks or redactions after cropping, click Reset Crop.
  5. Select Crop Box, draw a rectangle, then click Apply Crop. Odd/even crop rectangles share one size but keep independent positions.
  6. Use Undo or Ctrl+Z to revert an edit, then click Save PDF.

Tools

Tool Effect
Crop Box Changes the PDF CropBox. The content outside the visible area remains in the file.
Visual Mask Draws a colored rectangle over page content. The covered content remains in the file.
Redact Removes text and overlapping images or graphics in the selected rectangle. It does not remove metadata, attachments, or copies of the same information elsewhere in the document.

Use Redact when the content itself must be removed. Crop boxes and visual masks only change presentation.

Provenance manifest

Each save writes a JSON sidecar manifest unless a different path is supplied with --manifest-out. It records source and output SHA-256 hashes, page mapping and deletions, plus the crop, mask, and redaction rectangles applied.

Development

pytest
ruff check .

Build a standalone executable with PyInstaller:

pyinstaller --onefile --noconsole --name PyCropPDF run.py

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycroppdf-0.3.1.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycroppdf-0.3.1-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file pycroppdf-0.3.1.tar.gz.

File metadata

  • Download URL: pycroppdf-0.3.1.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pycroppdf-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b10f3a99eb0a0500fc01d8e912473e73aacb82238e0584b1da86706636cc0e79
MD5 25adb4de8717c64fc6b38ebc47a54bc6
BLAKE2b-256 698743c19ceacd624ad85dfc25c9ab4351692de37139e29e4e01f0de7890896b

See more details on using hashes here.

File details

Details for the file pycroppdf-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pycroppdf-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pycroppdf-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8815463410beb26a88ab69ee158700389918ff07ef419f0ee505f2bfc8de0e7
MD5 127e4aa7a680933fcba3d9d526ba6bd1
BLAKE2b-256 98144b35057b5f4ac0a68ccf9a7a62cf09cf667c09efb425075b61277edd1f48

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page