pdf2epub

pdf2epub is a skill for Claude Code, Codex from moonlight-lupin/agent-skills. It costs 100 tokens per session (2,284 once invoked), scanned A, original, MIT.

A command-line conversion tool that turns text-based PDF books into EPUB ebooks. It creates chapters, a table of contents, a cover, illustrations, and linked endnotes from footnotes.

In plain words
What is it for?
Use it to convert a text-layer PDF book for an e-reader, including books with printed contents pages and many footnotes.
Why use it?
It avoids treating a book as one undifferentiated document, making the resulting EPUB easier to navigate on an e-reader. It is not intended for image-only scans or PDF-to-Markdown extraction.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to convert a text-layer PDF book for an e-reader, including books with printed contents pages and many footnotes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/moonlight-lupin/agent-skills/pdf2epub
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add moonlight-lupin/agent-skills --skill pdf2epub
Clone the repo
git clone --depth 1 https://github.com/moonlight-lupin/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pdf2epub

README.md
[![agentmods](https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/pdf2epub/github.svg)](https://agentmods.dev/skills/moonlight-lupin/agent-skills/pdf2epub)
Your own site
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/pdf2epub"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/pdf2epub/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pdf2epub

Your own site · 80×15
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/pdf2epub"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/pdf2epub.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,284 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00100 $0.02284
Opus 5.5 $0.00040 $0.00914
Sonnet 5.5 $0.00020 $0.00457
Haiku 4.5 $0.00010 $0.00228

Measured 11d ago against content hash 6dd22b8ce56e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pdf2epub scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/pdf2epub.py, tests/test_pdf2epub.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

productivity/pdf2epub/SKILL.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pdf2epub

Overview

Convert a text-layer PDF to EPUB with real structure: cover image, one chapter per section, and a working 目录 (nav + ncx). Fully deterministic — no LLM in the conversion path. Engine: scripts/pdf2epub.py (pymupdf + ebooklib + Pillow).

When to Use

  • A text-layer PDF book should become an EPUB with cover + sections + TOC
  • A printed 目录/Contents page needs parsing into real EPUB nav
  • Footnote-heavy books (devotional/theological) need notes as linked endnotes, not body-text pollution

Don't use for: image-only scans (refused — route to document-toolkit OCR first) or PDF→Markdown extraction (that is opendataloader-pdf).

Run

python scripts/pdf2epub.py \
  input.pdf [-o out.epub] [--title T] [--author A] [--lang zh] [-v]

Needs pymupdf, ebooklib, Pillow (see requirements.txt). Create a dedicated venv for them if your environment pins system packages.

Optional flags: --no-footnotes keeps footnote text in body flow; --scan forces conversion of a scanless PDF.

Done when: exit 0, the report prints sections ≥ 1 with the expected chapter titles (check -v output), and the EPUB opens with its TOC intact. Verify deeper by zip-inspecting (see Verification).

TOC resolution order

  1. Embedded TOC (doc.get_toc()) — used when present; most reliable.
  2. Printed 目录/Contents page — first page in the first 15 pages matching /^目录$/ or /Contents$/. Line parser strips dot leaders (....... N) and keeps (title, printed_N). Resolution searches pages printed-3 … printed+40 for the title's first 16 chars, learns a single offset (majority vote), then maps every entry. Works when printed page numbers differ from PDF indices.
  3. Heading fallback — font-size outliers vs page median. Crude. Check -v output before accepting.

Cover

Strategy, in order of reliability:

  1. Single page-1 image covering ≥ 85% of the page area → extract that image at native resolution (real cover art as one asset).
  2. Anything else (multiple large images, a background texture with typography painted over it, no image) → render the full page at 200 DPI.

Read the full file on GitHub · 139 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 139 lines · 100 tokens per session scan A 6dd22b8ce56e

Subscribe to this mod's changes

pdf2epub is a skill published in the GitHub repository moonlight-lupin/agent-skills (101 stars, last pushed today), licensed MIT. It adds 100 tokens to every session and 2,284 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-06.

Related

Other skills, from other repositories

nano-pdf

Edit text in existing PDFs via natural-language prompts.

aivrar/portable-hermes-agent · 14 tokens

kagen

Convert Kami HTML templates to production-grade PDF via Chromium/Playwright. Complements Kami (design) with PDF rendering. Use when user asks to generate PDF files, render HTML to PDF, or export documents.

EliasOulkadi/shokunin · 0 tokens

kami

Generate PDFs, resumes, CVs, letters, slide decks, portfolios, one-pagers, white papers, and professional documents. Use when user asks to create a PDF, make a resume, write a letter, design slides, format a document, typeset a report, build a portfolio, make a presentation, or create a one-pager. Warm parchment…

EliasOulkadi/shokunin · 0 tokens

pdf-processing

Inspect, extract, OCR, create, merge, split, reorder, rotate, annotate, fill, redact, compress, secure, and verify PDF documents while preserving source files and visual fidelity. Use when working with one or more .pdf files; converting documents to or from PDF; extracting text, tables, images, metadata, forms, or…

seb1n/awesome-ai-agent-skills · 105 tokens

document-converter-suite

Convert local PDF, Office, Markdown, HTML, text, CSV, TSV, and JSON files; batch-convert folders, extract tables, fill templates, and edit PDF pages.

Rylaispirit/rylai-codex-hermes-skills · 41 tokens

pdf

Create, inspect, extract, merge, split, rotate, and render PDF files with local open-source tools, including structural and visual verification.

Rylaispirit/rylai-codex-hermes-skills · 30 tokens