Documents

epub-to-pdf-skill

Try it

Convert EPUB e-books to PDF using ebooklib + WeasyPrint with proper CJK font support.

What it does

Convert EPUB e-books to PDF using ebooklib + WeasyPrint with proper CJK font support.

The skill document

EPUB → PDF

Convert .epub files to PDF. Works for Chinese/Japanese/Korean text.

Prerequisites

apt-get install -y weasyprint
pip3 install --break-system-packages ebooklib beautifulsoup4 lxml

CJK fonts required:

  • /root/.openclaw/workspace/skills/pdf-maker/NotoSansCJKsc.ttf
  • /root/.openclaw/workspace/skills/pdf-maker/NotoSansCJKscB.ttf

Usage

python3 scripts/epub2pdf.py  

How it works

  1. ebooklib reads all ITEM_DOCUMENT entries from the EPUB
  2. BeautifulSoup + lxml strips , , , tags
  3. Injects CJK fonts via @font-face CSS
  4. WeasyPrint renders combined HTML to A4 PDF (2cm margins, justified)

Troubleshooting

SymptomFix
WeasyPrint import failsapt-get install weasyprint
CJK characters garbledEnsure font TTF path is correct (TTC collections won't work)
Empty / tiny PDFEPUB has no readable document entries — check TNC count
calibre root sandbox errorDon't use calibre; use this script instead

Related skills

Process EPUB files into structured extraction JSON, guide AI paragraph-aligned translation and summary filling, then assemble bilingual EPUBs with target-lan...

4 installs1 stars

Task-mode-driven EPUB reading and analysis skill with overview, targeted reading, chunked full reading, extraction, complex-content inspection, and batch pro...

21 installs

Use this skill when the user wants to convert ebook or document files between formats with Calibre, including EPUB to PDF, Markdown to EPUB, MOBI to EPUB, AZ...

21 installs

将扫描版PDF电子书通过OCR识别转换为结构化精排的EPUB格式。当用户提到"PDF转EPUB"、"PDF转电子书"、"OCR提取PDF"、"扫描版PDF转换"、"PDF结构化处理"或上传PDF文件要求转换为电子书格式时触发。不适用于纯文本PDF(可直接提取文字的PDF不需要OCR)、图片格式转换或PDF编辑功能。

Converts Markdown into an ElegantBook LaTeX book project and PDF. Invoke when user asks to typeset Markdown as a Chinese LaTeX book with diagrams.

電子書轉換工具箱:支援 EPUB / PDF / MOBI / AZW3 / FB2 → TXT / Markdown / HTML / JSON;批量轉換、封面萃取、元資料讀寫、圖書館自動分類。