Converting Scanned PDFs to Ebooks: Transforming into Markdown or EPUB Format

Preface

I have a stack of scanned PDFs—papers, old books, conference materials—that I want to put into a reader or notes library. The common approaches are manual OCR or online conversion. The former is time‑consuming; the latter often falls short for books with many pages and complex layouts. If you work in an Agent‑Skills‑enabled environment like Cursor, you can delegate “detect PDF, choose a backend, batch export” to scripts inside a Skill and complete the conversion locally.

Below is a community Skill on SkillHub, “Scanned PDF to ebook” (located at @user_c11cceac/scannedpdf2ebook), which converts scanned PDFs to Markdown or EPUB, relies on local OCR, and does not require an API key.

What Is This

In one sentence: it converts scanned book PDFs to Markdown or EPUB, supports multiple local OCR backends, and uses UV to manage the Python environment.

  • Maintainer: Community publisher user_c11cceac; source: community.
  • Category: Classified by SkillHub as office‑efficiency.
  • Version: 1.2.0 (per the SkillHub page).
  • SkillHub tag: requires_api_key=false, i.e., the Skill itself does not require an additional API key; actual conversion runs locally, and you need to install UV, Poppler, and an OCR backend yourself.

Official page: SkillHub - Scanned PDF to ebook.

Core Features

The following capabilities come from the SKILL.md file in the Skill package (named scanned-pdf-to-ebook):

Capability Description
PDF → Markdown Preserves heading hierarchy; images are placed in directories such as images/
PDF → EPUB Generates a table of contents; tables and formulas are rendered according to backend capabilities (EPUB is only supported by the pdf‑craft backend)
Multiple OCR backends pdf‑craft (DeepSeek OCR 2), Marker (Surya), MinerU (Shanghai AI Lab)
Text‑layer detection When a usable text layer exists, extract it directly to reduce unnecessary OCR
GPU / CPU Use larger models when a GPU is available; degrade gracefully without a GPU
Batch processing Directory‑level conversion; skips already‑generated files by default for resumable runs

Regarding trigger scenarios, the Skill description lists common phrases such as “Convert PDF to Markdown,” “Convert a scanned book to an ebook,” and “OCR‑recognize PDF,” making it easy for the Agent to choose during conversations.

Installation and Activation

1. Install the SkillHub CLI and add it to the current Agent

Follow the SkillHub installation instructions and first verify the CLI:

command -v skillhub && skillhub --version

If it is not installed, run the official installation script (full install or CLI‑only; see that document). When installing a Skill, you must point --dir to the current Agent’s skills directory; otherwise the default ./skills/ may not be recognized.

In Cursor, the skills directory is typically:

~/.cursor/skills/

The recommended command to install this Skill (consistent with the SkillHub search results):

skillhub install scannedpdf2ebook --namespace user_c11cceac --dir ~/.cursor/skills/

The SkillHub page also notes: refer to the above installation document to install @user_c11cceac/scannedpdf2ebook. Claude Code, Codex, and other clients use different paths (e.g., ~/.claude/skills/, ~/.codex/skills/); just replace --dir with the corresponding directory, and the form of the installation command remains the same.

After installation, enter the Skill’s actual directory (in the form .../@user_c11cceac/scannedpdf2ebook) and then configure the runtime environment.

2. Local runtime dependencies (Scripts inside the Skill)

The conversion logic is under the Skill’s scripts/ directory. In the Skill directory, you need to sync dependencies with UV and install at least one OCR backend. High‑level steps:

  1. Install UV (verify with uv --version).
  2. Install Poppler (Linux example: sudo apt install -y poppler-utils; verify with pdftoppm -v).
  3. In the Skill directory run uv sync, then install PyTorch and your chosen backend by platform (e.g., uv pip install pdf-craft).
  4. Environment check:
cd <SKILL_DIR>
uv run python scripts/check_env.py

Once the output shows “Environment ready” and at least one OCR backend is OK, you can invoke the CLI.

Platform and backend differences (MinerU on macOS Apple Silicon requires mineru[core], etc.) are covered in the Skill’s internal installation guide and are not expanded here.

Typical Usage

All commands are executed via uv run python in the Skill directory.

Optional: First detect the PDF type

uv run python scripts/pdf_craft_cli.py detect "/path/to/mybook.pdf"

Convert a single file to Markdown

uv run python scripts/pdf_craft_cli.py markdown "input.pdf" "output.md"

Convert a single file to EPUB (requires the pdf‑craft backend)

uv run python scripts/pdf_craft_cli.py epub "input.pdf" "output.epub" \
  --title "Book Title" --author "Author"

Specify an OCR backend

uv run python scripts/pdf_craft_cli.py -b marker markdown "input.pdf" "output.md"
uv run python scripts/pdf_craft_cli.py -b auto markdown "input.pdf" "output.md"

Batch conversion

uv run python scripts/batch_convert.py "/path/to/pdfs/" "/path/to/out/" -f markdown --recursive

In an Agent conversation, after installing and enabling the Skill, you can describe the task in natural language (e.g., specify paths and output format), and the Agent will call the above scripts according to SKILL.md; the exact paths depend on your local machine.

Use Cases and Notes

Who it suits

  • Developers or data managers who need to archive scanned books and papers locally as Markdown or EPUB.
  • Scenarios that want OCR to run locally without relying on cloud APIs (the Skill is marked as not requiring an API key, but models must be downloaded and may be on the order of several GB).

Limitations and cautions

  • Reserve disk space and time for the first run: PyTorch and OCR models are large; the installation footprint for pdf‑craft / Marker / MinerU is documented as roughly 2–5 GB.
  • EPUB is only supported by the pdf‑craft backend; using -b marker or -b minera to produce EPUB would exceed backend capabilities.
  • CPU mode is available but slower; without a GPU, the documentation suggests using smaller OCR models or lightweight backends such as Marker.
  • MinerU is documented as untested on Linux ARM or some macOS combinations, or requires special package names; check the Skill’s internal platform table before deployment.
  • SkillHub statistics (based on the retrieved data): rating 100000, downloads 1363, installs 18; this is a community Skill—evaluate your environment and compliance needs before use.

Closing

“Scanned PDF to ebook” encapsulates the workflow of converting scanned PDFs to Markdown/EPUB into a reusable Agent Skill: one‑click installation via SkillHub into clients such as Cursor, and local UV + Poppler + optional OCR backend to complete conversion and batch tasks. To review the introduction and version, open the official Skill page:

https://www.skillhub.cn/skills/user_c11cceac/scannedpdf2ebook

API entry (metadata): https://api.skillhub.cn/user_c11cceac/scannedpdf2ebook

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye