Skip to content

rvarchies/desktop-app-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFCore

Professional, offline-first PDF desktop application & processing engine built with Python and PySide6.

Python 3.12+ License: MIT Platform


Features

Desktop Application

  • Modern Dashboard UI — Sidebar navigation with Documents, Convert, Batch, and Settings tabs
  • Theme System — Dark, Light, and System-follow modes with smooth switching
  • Drag & Drop — Drop files or entire folders to open, batch process, or convert
  • PDF Canvas — Render and interact with PDF pages (zoom, pan, annotate)
  • Undo/Redo — Full transaction-based editing with coalescing and checkpoints

Batch Processing

  • Merge — Combine multiple PDFs into one
  • Split — Split by page range, every page, even/odd
  • Rotate — Rotate all pages (90°, 180°, 270°)
  • Compress — Reduce file size with configurable image quality
  • Watermark — Add text or image watermarks with opacity and position control
  • Rename — Batch rename using patterns ({index}_{original}, {date}_{title})
  • Page Numbers — Add page numbers with position/format options
  • Extract Text — Export text to .txt, .md, or .csv

Conversion

From To
PDF PNG, JPEG, WEBP, TIFF, BMP
PDF Text, Markdown, HTML
Images PDF
Text / Markdown PDF

Editing Tools

  • Selection & Pan — Navigate documents
  • Text Boxes — Add styled text with font, size, and color
  • Shapes — Rectangle, circle, line, polygon
  • Annotations — Highlight, redact (true content removal), image overlay
  • Page Operations — Insert, delete, duplicate, resize, extract pages
  • Markup — Watermark/stamp, page numbers, signature
  • Measure — Ruler, area measurement

Architecture

  • Dual-Engine Backend — PyMuPDF for rendering/text + pikepdf for structural operations
  • Plugin System — Sandboxed plugin execution with security hardening
  • Pipeline System — Decode → Transform → Encode conversion pipeline
  • State Management — Centralized Redux-style state with signals

Installation

Prerequisites

  • Python 3.12 or higher
  • pip

Quick Setup

# Clone the repository
git clone https://github.com/yourorg/pdfcore.git
cd pdfcore

# Create virtual environment
python -m venv .venv

# Activate (Windows PowerShell)
.\.venv\Scripts\Activate.ps1

# Activate (macOS / Linux)
source .venv/bin/activate

# Install with all dependencies
pip install -e ".[all,gui]"

Dependency Groups

pip install -e "."            # Core only (pydantic, click)
pip install -e ".[mupdf]"     # + PyMuPDF backend
pip install -e ".[pikepdf]"   # + pikepdf backend
pip install -e ".[gui]"       # + PySide6 desktop app
pip install -e ".[all]"       # All backends
pip install -e ".[dev]"       # Development tools (pytest, ruff, mypy)
pip install -e ".[all,gui,dev]"  # Everything

Usage

Desktop Application

python -m pdfcore.ui.app

CLI

# Document info
pdfcore info document.pdf

# Merge documents
pdfcore merge doc1.pdf doc2.pdf doc3.pdf -o merged.pdf

# Split document
pdfcore split document.pdf --pages 1-5 --pages 6-10 -o part_{n}.pdf

# Rotate pages
pdfcore rotate document.pdf --degrees 90 --pages 1-5

# Extract pages
pdfcore extract document.pdf --pages 1-5 -o first_five.pdf

# Extract text
pdfcore text document.pdf -o output.txt

# Validate structure
pdfcore validate document.pdf

Python API

from pdfcore import Document
from pdfcore.operations.page_ops import RotatePage

# Open a document
doc = Document("example.pdf")

# Get information
print(f"Pages: {doc.page_count}")
print(f"Title: {doc.metadata.get('title', 'Untitled')}")

# Edit with transactions (supports undo)
with doc.begin_transaction("Rotate first page") as tx:
    tx.execute(RotatePage(0, 90))

# Undo/redo
doc.undo()
doc.redo()

# Save
doc.save("output.pdf")

Project Structure

pdfcore/
├── backends/        # PDF engine abstractions (MuPDF, pikepdf)
├── cli/             # Command-line interface
├── editing/         # Content, structural, and visual operations
├── engine/          # Document class and session management
├── io/
│   ├── batch/       # Batch runner, state, rules
│   ├── decoders/    # Image, PDF, text decoders
│   ├── encoders/    # Image, PDF, text, HTML encoders
│   ├── formats.py   # Format detection and metadata
│   └── pipeline.py  # Decode → Transform → Encode pipeline
├── operations/      # Atomic, reversible page operations
├── plugins/         # Plugin loader, sandbox, API
├── transactions/    # Transaction and undo/redo system
├── ui/
│   ├── app.py       # Application entry point
│   ├── canvas.py    # PDF rendering canvas
│   ├── main_window.py  # Dashboard layout
│   ├── sidebar.py   # Icon-based tab navigation
│   ├── theme.py     # Dark/Light/System theme engine
│   ├── dialogs/     # Command palette, file dialogs
│   ├── panels/      # Tools, Inspector, Settings, Batch, Convert
│   └── state/       # Redux-style state management
└── utils/           # Logging, types, errors, security

Development

# Install dev dependencies
pip install -e ".[dev,all,gui]"

# Run the application
python -m pdfcore.ui.app

# Run CLI commands
pdfcore info document.pdf

# Run tests
pytest

# Type checking
mypy pdfcore

# Linting
ruff check pdfcore

# Format
ruff format pdfcore

License

MIT License — see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages