This repository provides safe, idiomatic Rust bindings to the MuPDF C library (Artifex Software), enabling programmatic reading, rendering, creation, and editing of PDF and other document formats. It is a library crate organized as a Cargo workspace with three sub-crates: `mupdf` (high-level API), `mupdf-sys` (FFI layer that compiles MuPDF from source), and optional font crates (`mupdf-fonts-droid`, `mupdf-fonts-noto`, `mupdf-fonts-sil`). The architecture is a classic FFI wrapper: `mupdf-sys` exposes raw C functions via `bindgen`, while `mupdf` provides safe Rust types (`Document`, `Page`, `Pixmap`, `PdfDocument`, `Shape`, etc.) with automatic resource management, error handling, and thread-safety checks. Key entry points include `Document::open()` for loading files, `Page::to_pixmap()` for rasterization, `Shape` for programmatic drawing, and `PdfDocument` for PDF-specific operations like annotation manipulation, form filling, and incremental saving. The library supports extensive feature flags (e.g., `js`, `xps`, `svg`, `tesseract`, `docx-output`) that control which MuPDF subsystems are compiled. The codebase demonstrates high craftsmanship through its safe wrapper patterns, builder-style APIs (e.g., `Shape`), extensible trait design (`FontLoader`, `NativeDevice`), and comprehensive test coverage including snapshot-based rendering tests and link extraction round-trip tests. It is not a data research project; it is a software library for document processing.
gImageReader is a mature, feature-rich desktop application that serves as a graphical frontend to the Tesseract OCR engine. It allows users to import images, PDFs, and DjVu documents, perform optical character recognition (OCR) with automatic or manual layout detection, and export the recognized text as plain text, hOCR (HTML-based OCR), PDF, or ODT. The application also integrates with scanner hardware via SANE (Linux) and TWAIN (Windows) backends, supports batch processing, and includes a spell checker, find/replace, and a substitution manager for post-processing. It is written in C++ and provides two parallel user interfaces: one using GTK+3 (gtkmm) and another using Qt5/Qt6, sharing a common core library in the `common/` directory. The architecture is a classic desktop monolith with a clear separation between the UI layer (GTK or Qt) and the backend logic (OCR, file handling, export). The codebase is well-organized with dedicated modules for scanning, image display, recognition, output editing, and export. Notable design patterns include a CRTP-based settings system (`ConfigSettings`), a custom tree model for file lists, and a worker-thread pattern for background scanning and rendering. The project has been actively maintained for over a decade, with recent commits and a large user base, though the dual-frontend approach introduces code duplication and maintenance overhead. While the application is not a research project, it demonstrates solid software engineering practices for a desktop GUI application. The most reusable components are the isolated utility classes in the `common/` directory, such as the CCITT Fax4 encoder, paper size definitions, and language mapping tables. These can be extracted and reused in other document-processing or PDF-generation projects with minimal modification. The overall code quality is good, with some areas showing age (e.g., version compatibility macros, WIP proofreading widget) but still functional and well-tested by the community.