🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

EPUB ↔ PDF Converter

by @bunsdev

Convert EPUB ↔ PDF bidirectionally. EPUB→PDF preserves layout for analysis; PDF→EPUB compresses and reflows for distribution and ereaders.

Versionv1.1.0
When to Use
TriggerAction
- Convert EPUB books, papers, or distributed documents to PDF for reading and analysis
- Preserve layout and formatting before text extraction via pdftoppm
- Archive EPUB content in a fixed-layout format
- Prepare EPUBs for downstream processing (rendering, analysis, synthesis)
### PDF → EPUB
- Convert papers and PDFs to reflowable EPUB format for ereader distribution
- Compress PDFs into smaller, device-friendly EPUB archives
- Auto-detect chapters and structure for better reading experience
- Redistribute research materials in open formats
💡 Examples

EPUB → PDF (basic)

ebook-convert input.epub output.pdf

EPUB → PDF (with layout preservation options)

ebook-convert input.epub output.pdf \
  --pdf-standard-font "sans" \
  --paper-size "a4" \
  --margin-left 20 \
  --margin-right 20 \
  --margin-top 20 \
  --margin-bottom 20 \
  --pdf-mono-family "mono"

Note: Valid font families are: serif, sans, mono (not Helvetica, etc.)

PDF → EPUB (basic)

ebook-convert input.pdf output.epub

PDF → EPUB (with compression)

ebook-convert input.pdf output.epub \
  --output-profile "tablet" \
  --paper-size "a4"

Note: ebook-convert auto-detects chapters from PDFs. Inspect the output EPUB to verify structure.

In context (Sage workflow)

#### EPUB → PDF

# Convert EPUB to PDF for analysis
ebook-convert "/path/to/input.epub" "/path/to/research/sources/output.pdf"

Verify and check size

ls -lh "/path/to/research/sources/output.pdf"

Render pages for visual inspection

pdftoppm -png "/path/to/research/sources/output.pdf" "/tmp/preview/page"

#### PDF → EPUB

# Convert PDF to EPUB for distribution
ebook-convert "/path/to/input.pdf" "/path/to/research/sources/output.epub"

Verify compression

ls -lh "/path/to/input.pdf" "/path/to/research/sources/output.epub"

(EPUB will typically be 30-50% of PDF size)

📋 Tips & Best Practices

  • Layout preservation (EPUB→PDF): ebook-convert maintains structure, typography, images
  • Reflowable format (PDF→EPUB): EPUB reflows to device width; fixed-layout PDFs may lose structure
  • Chapter detection (PDF→EPUB): Automatic; works best on PDFs with clear page breaks or bookmarks
  • Scanned PDFs: May fail or produce text-only output (no OCR)
  • Large files: Some books convert to large files (100+ MB PDFs/EPUBs). Normal.
  • View on ClawHub
    TERMINAL
    clawhub install epub-to-pdf

    🧪 Use this skill with your agent

    Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

    🔍 Can't find the right skill?

    Search 60,000+ AI agent skills — free, no login needed.

    Search Skills →