Repository navigation
PDF Craft v2.4.2
PDF Craft 2.4.2 fixes OCR-based document metadata extraction and unifies business
execution around async implementations. PDFCraft remains the synchronous facade
over AsyncPDFCraft.
OCR metadata extraction
Book metadata extraction now awaits the guaranteed JSON repair loop and LLM runtime
throughout the request chain. This fixes the blocking guaranteed JSON request returned an awaitable error and the unawaited-coroutine warning that caused extraction to fall
back to native PDF metadata. When a PDF has no native title, a supported title from
the OCR response can now reach document.title in the exported PCEX.
A regression test exercises the actual LLM runtime with a simulated network response
and verifies that Attention Is All You Need reaches the PCEX manifest when native
metadata is empty.
See #503.
Async execution and extension contracts
- LLM requests, JSON/XML repair loops, translation, and executable extensions use
async contracts. LLM configuration remains declarative; tokenizer and prompt
resources are loaded through the async runtime. - PDF patching prepares extraction content and runs Ghostscript asynchronously,
with native Qt composition isolated in a worker process. Custom PDF handlers and
visual compilers execute on the caller's event loop. - Markdown and EPUB rendering use async orchestration. Filesystem operations and
synchronous third-party generation remain in dedicated execution domains. - OCR metadata and table-of-contents file scans run outside the event-loop thread.
- Cancellation cleans temporary resources and cancels pending async fill-recovery
callbacks. Fill-recovery callbacks run on the caller's event loop.
Public API
- Await
PDFTranslationPipeline.patch(),PDFPatcher.patch(), and
GhostscriptVisualBaseCompiler.compile(). - Custom PDF providers implement
AsyncPDFHandlerandAsyncPDFDocument; custom
visual compilers implementasync def compile(source_path, target_path). - Model download uses
await predownload_models(...)or
await AsyncPDFCraft().predownload_models(...). Synchronous applications use
PDFCraft().predownload_models(...). - The package's public PDF provider contracts are
AsyncPDFHandlerand
AsyncPDFDocument. Native synchronous PDF adapters are internal implementation
details.
The API references and installation guides describe these execution contracts.
Full Changelog: v2.4.1...v2.4.2