Stirling PDF is a comprehensive, open-source PDF processing platform that provides 50+ document manipulation tools (merge, split, compress, OCR, sign, redact, convert, etc.) via a web UI, REST API, and desktop client (Tauri). The backend is a modular Java Spring Boot application split into core, common, proprietary, and SaaS modules, while the frontend is a React/TypeScript app with Mantine UI and Storybook. The system also includes a Python FastAPI engine for AI-powered features such as document classification, math auditing, and question answering, and an enterprise policy engine for automated document workflows with triggers, pipelines, and output sinks (local, S3, vector DB). It supports self-hosted, SaaS (Supabase/Stripe), and desktop deployment modes with clustering via Valkey/Redis backplane, SSO/OAuth2/SAML2 authentication, and comprehensive billing/licensing (PAYG, subscriptions, enterprise). The architecture is multi-module with clear separation of concerns: `app/common` provides shared utilities (PDF parsing, security, cluster abstractions, temp file management), `app/core` implements core PDF operations, `app/proprietary` adds enterprise features (encrypted storage, policy engine, audit, hardware signing), and `app/saas` handles SaaS-specific billing and team management. The frontend uses a shadowing pattern to swap implementations per build variant (core, proprietary, desktop, SaaS) without conditional imports. The AI engine runs as a separate Python service with streaming progress events and two-round protocols for complex tasks. Key data flows include: PDF upload → tool execution (Java PDFBox/iText) → output download; policy-triggered processing (folder watch, schedule) → pipeline execution → output delivery; AI agent workflows (classification, auditing) with progress streaming. External dependencies include LibreOffice (document conversion), Tesseract (OCR), PDFBox, iText, and various cloud services (Supabase, Stripe, PostHog). The codebase demonstrates high craftsmanship with extensive unit/integration/E2E tests, reusable component patterns (createToolFlow, useBaseTool), and well-abstracted interfaces for storage, signing, licensing, and clustering.
pdfcpu is a comprehensive PDF processing library and command-line tool. It provides a full suite of operations including validation, optimization, encryption, digital signing (PAdES/CAdES), form filling, watermarking, page imposition (booklet, n-up), content extraction, and PDF creation from JSON. The architecture is a monolithic library with a clear separation between a public API layer (`pkg/api/`), CLI command definitions (`pkg/cli/`), core processing logic (`pkg/pdfcpu/`), and a robust validation engine (`pkg/pdfcpu/validate/`). It implements a staged output pattern for safe file writes and a context-based cancellation system. While the feature set and test coverage are exceptional, the codebase is written in a non-standard Go dialect (using `func`, `type`, `var` keywords and a `go 1.25.0` module version), which represents a significant technical drift risk and limits its maintainability by the broader Go ecosystem. Despite this, it contains several genuinely reusable, well-crafted components such as its LZW codec, safe math utilities, path sanitizer, and BER/DER parser.