github oomol-lab/pdf-craft v2.0.0

latest releases: v2.6.7, v2.6.6, v2.6.5...
3 months ago

🎉 PDF Craft v2.0.0 Official Release

PDF Craft v2.0.0 is a major step forward: the project is no longer only a scanned-PDF converter. It is now a complete document conversion and translation toolkit built around PDF, Markdown, EPUB, and translated PDF output.

This release brings the EPUB translation capability into PDF Craft itself, introduces a safe PDF patching pipeline for translated output, unifies the public API around PDFCraft, and makes the project usable with either local GPU OCR or remote vendor OCR.

🚀 A Complete PDF Conversion and Translation Workflow

PDF Craft 2.0 introduces PDFCraft, a single public entry point for the workflows users actually need:

  • Convert scanned PDFs to Markdown or EPUB
  • Translate while converting a PDF to Markdown or EPUB
  • Translate an existing EPUB into a target-language or bilingual edition
  • Translate a scanned PDF and write the translated text back into the matching source PDF
  • Split advanced workflows into extraction, translation, rendering, and PDF patching stages when more control is needed

This means PDF Craft can now cover the whole route from a scanned book to a readable EPUB, a searchable Markdown file, a bilingual edition, or a translated PDF that retains the source page layout.

📚 EPUB Translation Is Now Built In

EPUB translation is now part of PDF Craft rather than a separate workflow. Existing EPUB files can be translated directly while preserving their chapters, table of contents, images, metadata, and layout as far as the source format allows.

You can choose how translated text appears:

  • REPLACE creates a target-language-only edition
  • APPEND_TEXT keeps source and translation together in the same reading flow
  • APPEND_BLOCK creates a clearer bilingual edition by placing the translation in its own block after the source text

The EPUB pipeline also supports custom prompts, retries, concurrent translation, local request caching, progress callbacks, failure callbacks, and separate LLMs for translation and XML structure repair.

🧩 Translate PDFs Without Rebuilding Their Layout

PDF translation now has a dedicated patching pipeline. PDF Craft records the source locations produced during extraction, translates the content, then writes the replacement text back into the corresponding areas of the original PDF.

This is designed for translation of an existing PDF, not general-purpose PDF page design. It preserves the original visual document wherever possible while replacing the text that PDF Craft extracted from that document.

⚙️ Choose Local GPU OCR or a Remote OCR Service

Version 2.0 supports six OCR backends across three model families:

Each family can run locally on a CUDA-capable NVIDIA GPU or through a vendor backend that uses remote compute. This removes the old all-or-nothing CUDA requirement:

  • Use pip install pdf-craft with vendor OCR when you do not have a suitable GPU or prefer a managed remote service.
  • Use pip install "pdf-craft[local]" when you want to run OCR models locally with your own CUDA environment and model cache.

🛡️ Better Reliability for Long-Running Work

Large books and remote OCR calls need more than a happy-path conversion command. This release adds a stronger operational foundation:

  • OCR cache ownership checks prevent results from a different input or OCR configuration from being reused accidentally
  • Interrupted work can recover missing OCR pages instead of starting over unnecessarily
  • Translation caching avoids repeating completed requests
  • Local OCR and vendor OCR routes are covered by reproducible smoke and CLI workflows
  • Unsupported DeepSeek OCR 2 local presets fail early with a clear recommendation instead of failing deep inside upstream model code

✨ A Clearer 2.0 Public API

The public conversion API is now centered on PDFCraft. The retired top-level transform_markdown and transform_epub wrappers have been removed.

For most integrations, migrate to:

craft.convert_pdf_to_markdown(...)
craft.convert_pdf_to_epub(...)

Advanced users can also use the explicit extraction, package translation, rendering, and PDF patching operations exposed by PDFCraft.

📖 Documentation Refresh

The English and Chinese READMEs have been rewritten around the paths users take in practice: installation, first PDF conversion, translation, EPUB output, and OCR backend selection. Chinese advanced guides now cover installation, OCR configuration, PDF conversion and translation, EPUB translation, API reference, and troubleshooting.

Selected Pull Requests

Full Changelog: v1.0.14...v2.0.0

Don't miss a new pdf-craft release

NewReleases is sending notifications on new releases.