Skip to main content

Privacy-first CLI tool for offline PDF processing

Project description

OfflinePDF

Privacy-first CLI tool for offline PDF processing

OfflinePDF is a command-line utility that provides common PDF manipulation tools (similar to iLovePDF) but runs 100% locally on your machine with zero network access. All processing happens offline, ensuring your documents never leave your computer.

🔒 Privacy Guarantee

  • No internet access - All processing is local-only
  • No telemetry or analytics - We don't track anything
  • No file uploads - Files are never sent anywhere
  • No data storage - Files are processed and immediately discarded
  • Open source - You can audit the code yourself

✨ Features

  • Unlock PDFs - Remove password protection from PDF files
  • Lock PDFs - Add password protection to PDF files
  • Compress PDFs - Reduce PDF file size
  • Merge PDFs - Combine multiple PDF files into one
  • PDF to DOCX - Convert PDF documents to Word format
  • DOCX to PDF - Convert Word documents to PDF format
  • Image to PDF - Convert images (JPG, PNG, etc.) to PDF format

📦 Installation

Using pipx (recommended for global installation)

pipx is the recommended way to install OfflinePDF globally. It installs the package in an isolated environment, preventing dependency conflicts with other Python packages.

Install pipx first

macOS:

brew install pipx
pipx ensurepath

Linux (Ubuntu/Debian):

sudo apt update
sudo apt install pipx
pipx ensurepath

Linux (Fedora/RHEL):

sudo dnf install pipx
pipx ensurepath

Windows:

# Using pip
python -m pip install --user pipx
python -m pipx ensurepath

# Or using winget
winget install pipx

Alternative (all platforms):

python3 -m pip install --user pipx
python3 -m pipx ensurepath

After installing pipx, restart your terminal or run:

source ~/.bashrc  # Linux/macOS
# or
source ~/.zshrc   # macOS with zsh

Install OfflinePDF with pipx

pipx install offlinepdf

After installation, the offlinepdf command will be available globally from anywhere in your terminal.

Using pip (alternative)

If you prefer to use pip directly:

pip install offlinepdf

Note: Using pip may cause dependency conflicts with other Python packages. pipx is recommended for CLI tools.

🚀 Usage

Unlock a PDF

offlinepdf unlock input.pdf --password mypassword

Lock a PDF

offlinepdf lock input.pdf --password mypassword

Compress a PDF

offlinepdf compress document.pdf

Merge multiple PDFs

offlinepdf merge a.pdf b.pdf c.pdf -o merged.pdf

Convert PDF to DOCX

offlinepdf pdf2docx input.pdf
# Creates: input_docx.docx

offlinepdf pdf2docx input.pdf -o output.docx

Convert DOCX to PDF

offlinepdf docx2pdf document.docx
# Creates: document_pdf.pdf

Convert image to PDF

# Single image
offlinepdf image2pdf image.jpg
# Creates: image_pdf.pdf

# Multiple images (merged into one PDF)
offlinepdf images2pdf img1.jpg img2.png img3.jpg -o combined.pdf

📋 Command Reference

unlock

Remove password protection from a PDF.

offlinepdf unlock <input.pdf> --password <password> [--output <output.pdf>]

lock

Add password protection to a PDF.

offlinepdf lock <input.pdf> --password <password> [--output <output.pdf>]

compress

Compress a PDF file to reduce its size.

offlinepdf compress <input.pdf> [--output <output.pdf>]

merge

Merge multiple PDF files into one.

offlinepdf merge <pdf1> <pdf2> ... [--output <output.pdf>]

pdf2docx

Convert a PDF file to DOCX format.

offlinepdf pdf2docx <input.pdf> [--output <output.docx>]

docx2pdf

Convert a DOCX file to PDF format.

offlinepdf docx2pdf <input.docx> [--output <output.pdf>]

image2pdf

Convert image file(s) to PDF format.

# Single image
offlinepdf image2pdf <image.jpg> [--output <output.pdf>]

# Multiple images
offlinepdf images2pdf <img1> <img2> ... [--output <output.pdf>]

Supported image formats: JPG, JPEG, PNG, BMP, GIF, TIFF, WEBP

🛠️ Requirements

  • Python 3.11 or higher
  • pipx (recommended) or pip
  • All dependencies are automatically installed with the package

🔧 Development

If you want to contribute or modify the code:

# Clone the repository
git clone https://github.com/Daniyal-Qureshi/offlinepdf.git
cd offlinepdf

# Install in development mode
pip install -e .

# Or using pipx for development
pipx install -e .


## 📝 License

MIT License - see [LICENSE](LICENSE) file for details.

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## ⚠️ Limitations

- **PDF to DOCX conversion**: Quality depends heavily on document structure. Complex layouts (multi-column, tables, icons, vector graphics) may not convert correctly. This is a known limitation of open-source PDF parsers. The tool will automatically try LibreOffice as a fallback if available.
- Large files may take longer to process
- DOCX to PDF conversion requires Microsoft Word (macOS/Windows) or LibreOffice (Linux) to be installed

## 🐛 Troubleshooting

**Command not found after installation:**
- If using pipx: Make sure you ran `pipx ensurepath` and restarted your terminal
- If using pip: Make sure your Python `bin` directory is in your PATH
- **Recommended:** Use `pipx` for global installation to avoid PATH issues
- Restart your terminal after installation

**pipx not found:**
- Install pipx using the instructions in the Installation section above
- After installing pipx, run `pipx ensurepath` to add it to your PATH
- Restart your terminal

**Permission errors:**
- Make sure you have read access to input files
- Make sure you have write access to the output directory

**Conversion errors:**
- Verify that input files are not corrupted
- Check that file formats are supported
- Ensure sufficient disk space is available

## 📚 Dependencies

- [Typer](https://typer.tiangolo.com/) - Modern CLI framework
- [Rich](https://rich.readthedocs.io/) - Beautiful terminal output
- [pikepdf](https://github.com/pikepdf/pikepdf) - PDF manipulation
- [pdf2docx](https://github.com/dothinking/pdf2docx) - PDF to DOCX conversion
- [docx2pdf](https://github.com/AlJohri/docx2pdf) - DOCX to PDF conversion
- [Pillow](https://pillow.readthedocs.io/) - Image processing

## 🔄 Updating

To update to the latest version:

```bash
# Using pipx (recommended)
pipx upgrade offlinepdf

# Using pip
pip install --upgrade offlinepdf

🗑️ Uninstalling

To uninstall:

# Using pipx
pipx uninstall offlinepdf

# Using pip
pip uninstall offlinepdf

Made with ❤️ for privacy-conscious users

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

offlinepdf-1.0.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

offlinepdf-1.0.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file offlinepdf-1.0.2.tar.gz.

File metadata

  • Download URL: offlinepdf-1.0.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for offlinepdf-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c6b0fa09858e821e569ccc65806b605355e2847e7f3db5a9ff7bdfb418cab674
MD5 ecc58319dd8ef3e2af698ffb5a1541c0
BLAKE2b-256 853da22927ade48473d57c1abdbcf292acdc63897fdeb45a510ccf0735a5bc30

See more details on using hashes here.

File details

Details for the file offlinepdf-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: offlinepdf-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for offlinepdf-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa1fab7f295aee025abf03e869737dc9b018c6af489deb04a4ad6f2f2bfd5f9a
MD5 8e7636c87ba25db9cd6e2485bcab3b63
BLAKE2b-256 7c7a232dd115ff5c5bbc17d20385e9ce3c867f48350ce157f2fe66eab4fd5bd4

See more details on using hashes here.

Supported by

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