Skip to main content

📄 pdf-tool

Local PDF tools for the command line, AI agents and the desktop. Nothing leaves your computer.

English · Español

PyPI CI Release License Platform

Merge, split, compress, protect and watermark PDFs, or turn images into PDFs, with a CLI built for scripts and AI agents, an agent skill, and a desktop app for everyone else. Free, open source, no ads, and 100% offline: your files are never uploaded anywhere.

pipx install pdf-tool-cli
pdf-tool compress report.pdf --target-mb 2

🧰 Tools

Command What it does
pdf-tool compress Shrinks one or more PDFs to a target size in MB.
pdf-tool merge Combines several PDFs into one, in the order you give.
pdf-tool split Splits a PDF by page ranges, one page per file, or every N pages.
pdf-tool images2pdf Turns each JPG/PNG image into its own PDF.
pdf-tool protect Adds or removes the password of one or more PDFs.
pdf-tool watermark Repeats a text diagonally across every page.

It never overwrites your files: outputs go next to the original (or to --output-dir) with a new name.


⌨️ Command line

pipx install pdf-tool-cli                      # or: uv tool install pdf-tool-cli
pdf-tool list --json                           # tools, accepted inputs and parameters
pdf-tool compress big.pdf --target-mb 2 --json # result as JSON
pdf-tool compress big.pdf --target-mb 2 --mode preserve   # keep text and links
pdf-tool merge a.pdf b.pdf c.pdf --output-name report
pdf-tool split doc.pdf --ranges "1-3, 5, 8-"
printf '%s' "$PASSWORD" | pdf-tool protect doc.pdf --password-stdin
  • Help: pdf-tool <tool> --help lists every flag.
  • JSON for agents: --json prints a stable structure (ok, summary, outputs, per-file items, warnings, metrics such as sizes before and after compressing).
  • Exit codes: 0 success · 1 processing failed · 2 invalid usage · 3 batch finished but some files failed.
  • Passwords are read from stdin (--password-stdin) or the PDFTOOL_PASSWORD variable, never from arguments.
  • Language: messages and output file names follow your system language; --lang en or --lang es overrides it (or set PDFTOOL_LANG).
  • Compression modes: max (default) tries to reduce images first and only turns pages into images if that is the only way to reach the target (it warns you). preserve never does, so text, links and annotations are kept.

Requires Python 3.11+. pipx install 'pdf-tool-cli[gui]' also installs the desktop app (command pdftool).


🤖 Use it with AI agents

A skill teaches your agent to use pdf-tool instead of writing throwaway scripts: it asks before installing the CLI, runs the tools with --json and explains the result in your language. It follows the open Agent Skills format, so it works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot and others. Pick one way:

1. Claude Code (plugin, recommended): updates itself from main.

/plugin marketplace add juanMaAV92/pdf-tool
/plugin install pdf-tool@pdf-tool

2. Any agent, with skills (needs Node.js): detects your agents and copies the skill into each one's folder. Add -g to have it in every project; update it with npx skills update.

npx skills add juanMaAV92/pdf-tool

3. By hand: copy the skills/pdf-tool folder into your agent's skills folder (paths per agent). Copy it again to update.

In all three, the CLI is installed separately (pipx install pdf-tool-cli); if it is missing, the skill asks for permission to install it.


🖥️ Desktop app

pdf-tool desktop app: home screen with the six tools

The same six tools with a simple interface, in English or Spanish, for macOS and Windows. No Python needed.

Download

  • macOS: open the .dmg and drag pdf-tool to Applications. The app is not signed, so the first time go to System Settings → Privacy & Security and click Open Anyway.
  • Windows: run the installer. If SmartScreen appears: More info → Run anyway.

Step-by-step guide, screenshots and FAQ: juanmaav92.github.io/en/pdf-tool. Every release publishes SHA256SUMS.txt so you can check the download.


🤝 Contributing

Issues and pull requests are welcome. Adding a tool means creating one folder: the app and the CLI discover it on their own. Translations are welcome too: copy pdftool/i18n/locales/en.json to <code>.json and translate it. The roadmap lists what comes next.

🛠️ Developer setup

Requirements

Run

poetry install --all-extras   # includes Flet (the [gui] extra) for the app
poetry run pdftool            # opens the app
poetry run pdf-tool --help    # the CLI
poetry run pytest             # tests

Add a tool

  1. Create pdftool/tools/<id>/ with params.py, logic.py (pure function + tests), spec.py (registers the tool, no Flet), panel.py and an empty __init__.py.
  2. Add its texts to pdftool/i18n/locales/en.json and es.json, and an example to the skill.
  3. The app shows it in the sidebar and the CLI offers it as pdf-tool <id>, both automatically.

Details in AGENTS.md.

Release (automated with GitHub Actions)

git tag vX.Y.Z
git push origin vX.Y.Z

release.yml runs the tests, builds macOS (.dmg) and Windows (Inno Setup installer) in parallel, bakes the tag version into the build and creates a draft GitHub Release with both installers. Review it and click Publish release so installed apps detect the update. It also publishes the package to PyPI (pdf-tool-cli, via Trusted Publishing); that step waits for your approval in Actions (pypi environment), because a PyPI version cannot be replaced. The tag is the only source of the version number.

PRs that change the app, the packaging or its dependencies also run Package smoke, which builds the macOS DMG and silently installs the Windows installer. Before a major release, follow the manual checklist.

Local build (to debug packaging)

poetry run flet build macos --project pdf-tool --product pdf-tool     # -> build/macos/pdf-tool.app
poetry run flet build windows --project pdf-tool --product pdf-tool   # -> build/windows/

--project pdf-tool is required: without it, flet build takes the package name (pdf-tool-cli) and the app changes identity.


📄 License

The pdf-tool source code is MIT. It uses PyMuPDF, licensed under the AGPL, so the installers and the PyPI package, which include it, are distributed under the terms of the AGPL. Your documents are unaffected: they stay yours and never leave your computer.


Made with 🐍 Python + Flet · Powered by @juanmaav92

Metadata

Release files for pdf-tool-cli 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf-tool-cli 1.2.0
File Size Uploaded Provenance Actions
pdf_tool_cli-1.2.0.tar.gz 70.5 kB With provenance Details for pdf_tool_cli-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pdf-tool-cli 1.2.0
File Interpreter ABI Platform Actions
pdf_tool_cli-1.2.0-py3-none-any.whl Python 3 none any Details for pdf_tool_cli-1.2.0-py3-none-any.whl

Total release size: 163.3 kB

Release files / pdf_tool_cli-1.2.0.tar.gz

Download URL pdf_tool_cli-1.2.0.tar.gz
Size 70.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4d6dfebd414622017f7eae2be359d7d9dfdbabf14395860013231ff968d5a9d3
BLAKE2b-256 checksum
How to use checksums
c1c0b02b21983e232d6154276998fad7f7834b3e923250dda41dba9417313447
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / pdf_tool_cli-1.2.0-py3-none-any.whl

Download URL pdf_tool_cli-1.2.0-py3-none-any.whl
Size 92.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9523486bc0f5c70b44e390aca776999cdc926b9c64538ec11a0adc480f46eef4
BLAKE2b-256 checksum
How to use checksums
fc1c117b0aa35446554d020794fe6585da5ff63bc9de827d38ef17b06fc90e9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for pdf-tool-cli 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pdf_tool_cli-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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