Reading the repo
Opening the box…
Reading the repo
Opening the box…
How to install on macOS
PDF craft can convert PDF files into various other formats. This project will focus on processing PDF files of scanned books.
Saved setup from 4 h ago
Will it work on macOS?
Heads-upIt also needs 44 settings in .env (8 secret).
Then run bash setup.sh. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
Needs Git: xcode-select --install
git clone https://github.com/oomol-lab/pdf-craft.git cd pdf-craft
Python >=3.11,<3.14
brew install python@3.11 pipx install poetry
Fill in secrets: PDF_CRAFT_JEV_API_KEY, PDF_CRAFT_DEEPSEEK_OCR_API_KEY, PDF_CRAFT_DEEPSEEK_OCR_MAX_TOKENS, PDF_CRAFT_DEEPSEEK_OCR2_API_KEY, PDF_CRAFT_DEEPSEEK_OCR2_MAX_TOKENS, PDF_CRAFT_UNLIMITED_OCR_ACCESS_KEY, PDF_CRAFT_UNLIMITED_OCR_SECRET_KEY, PDF_CRAFT_LLM_DEFAULT_TOKEN_ENCODING
cp .env.template .env
poetry install
poetry run pytest
This example uses remote OCR to convert a PDF to Markdown. Prepare Python 3.11–3.13, Poppler, and a working DeepSeek OCR-compatible service configuration. See the installation guide for Poppler setup.
Just need to convert a file without setting up a development environment or OCR service? Use PDF Craft Online and upload your PDF in a browser.
python -m pip install pdf-craft
Place input.pdf in the directory where you run your script. Replace the URL, API key, and model name with your service configuration:
from pdf_craft import DeepSeekOCRVendorConfig, PDFCraft, PDFOptions
craft = PDFCraft(
pdf=PDFOptions(
ocr=DeepSeekOCRVendorConfig(
base_url="https://example.com/v1",
api_key="your-api-key",
model="deepseek-ocr",
),
),
)
craft.convert_pdf_to_markdown("input.pdf", "output.md")
Async applications use the same options through AsyncPDFCraft; callbacks may
also be async def functions and run on the caller's event loop:
import asyncio
from pdf_craft import AsyncPDFCraft, DeepSeekOCRVendorConfig, PDFOptions
async def main():
craft = AsyncPDFCraft(pdf=PDFOptions(ocr=DeepSeekOCRVendorConfig(
base_url="https://example.com/v1",
api_key="your-api-key",
model="deepseek-ocr",
)))
await craft.convert_pdf_to_markdown("input.pdf", "output.md")
asyncio.run(main())
Do not call the synchronous PDFCraft facade from a running event loop; use
AsyncPDFCraft and await its corresponding method instead.
https://example.com/v1 is a placeholder, not a working endpoint. Use a compatible service that actually provides the OCR model. See OCR configuration for other models. If you do not have an OCR service yet, you can convert your files with PDF Craft Online.
Open output.md after conversion. Documents containing images also produce asset files; keep those files with the Markdown when moving or sharing it.
Reuse the configured craft instance above and replace the last line with:
craft.convert_pdf_to_epub("input.pdf", "output.epub")
Open output.epub in an EPUB reader. For title, author, and rendering options, see PDF conversion and translation. For installation or runtime problems, see troubleshooting.
For EPUB bibliographic metadata, opt in to front-page OCR metadata extraction and provide a separate metadata LLM. PDF Craft accepts only values it can verify against OCR evidence. PDF file properties fill missing fields; they never override information printed in the book.
No reports for macOS yet.
GitManual AI Agent reads the 6 key files and writes a step-by-step guide for macOS. Once written, it's saved for everyone.