跳到正文
FunCoding

any-to-pdf

Turn Markdown, text, Word, HTML, CSV, code or images into a professionally typeset PDF — cover page, table of contents, themes, tables, code blocks, CJK text and emoji — with the bundled converter. Use it when the owner wants a polished PDF rather than a plain export.

Star
4,080
许可证
MIT
最近提交
2026年12月1日

src/skills/bundled/any-to-pdf/SKILL.md

在 GitHub 上查看

Any to PDF

Use this when the owner wants a good-looking PDF: a report, a write-up, notes, a data table or a set of images. For other formats (Word, slides, spreadsheets) use the documents skill.

Run it

The converter is in this skill's scripts/ folder (the folder path is shown with these instructions). Run it with Python 3.8 or newer — python3 on macOS, Linux and Termux, python or py on Windows:

python3 "<skill folder>/scripts/any2pdf.py" report.md -o report.pdf
  • Inputs: Markdown and text; Word (.docx); HTML; CSV/TSV (become tables); code, JSON, YAML and logs (become code blocks); images (one page each). With pandoc installed, also ODT, RTF, EPUB, reStructuredText, LaTeX and notebooks. Several inputs make one PDF, in the order given.
  • Output: -o names the PDF; without it, the PDF sits next to the first input. It never overwrites an input.
  • First run: it installs what it needs into Mercury's cache (~/.mercury/cache/any2pdf), never into the system Python. reportlab first (about 20 MB). A Word file adds mammoth, HTML adds markdownify (each under 1 MB). Display formulas ($$ … $$) add matplotlib (about 100 MB) for typeset maths; if that can't be installed, formulas still appear as styled text. Tell the owner when a first run is installing something.

Options

Pass them after the inputs:

OptionWhat it does
--theme NAMELook and colours (below). Default warm-academic.
--title, --subtitle, --author, --date, --versionCover page text (title defaults to the first heading).
--cover false, --toc falseLeave out the cover page or the table of contents. Short documents read better without both.
--watermark "DRAFT"Diagonal watermark on every page.
--page-size LetterUS Letter instead of A4.
--header-title, --footer-leftRunning header and footer text.
--frontispiece IMG, --banner IMGFull-page image after the cover; back-cover image.
--disclaimer, --copyrightBack-cover text.

Themes: warm-academic (ivory and terracotta), github-light (clean white and blue), nord-frost, solarized-light, paper-classic, ocean-breeze, tufte (minimal), classic-thesis, ieee-journal, elegant-book, chinese-red, ink-wash (greyscale), monokai-warm, dracula-soft. references/themes.md describes them.

Workflow

  1. Get the content into one file. If you're writing the document, write Markdown first (headings, lists, tables, fenced code).
  2. Pick the options yourself. Use what the owner asked for; otherwise choose a theme that fits the content (github-light for technical documents, warm-academic or elegant-book for reports, tufte for prose) and leave out the cover and contents for anything under about three pages. Only ask the owner about styling when they said they care about it — and never in an unattended run.
  3. Run the converter and read its last line: PDF: <path> (<size>).
  4. Check it. The file exists and isn't tiny. If a page might be wrong (CJK, tables, images), look at it before saying it's done.
  5. Deliver it. Say where it is; on chat channels send it with send_file.

When it fails

  • No Python: say so and fall back to the documents skill (pandoc, or HTML printed to PDF).
  • pip can't install: the error names the fix (usually install pip for that Python). Offline machines can't do a first run.
  • Missing fonts on Linux (boxes instead of characters): fonts-noto-cjk and fonts-noto-color-emoji fix it; the PDF is still produced.

The converter (scripts/md2pdf.py) is lovstudio/any2pdf, MIT License — see scripts/LICENSE-md2pdf.txt.

相似的 Skill

精选

pptx

生成、读取和修改演示文稿,也能合并拆分幻灯片。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

docx

创建和编辑 Word 文档,支持目录、页码、页眉等排版。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

pdf

提取文本和表格、合并拆分、填写表单,也能对扫描件做 OCR。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

doc-coauthoring

按步骤协作撰写技术方案、提案和决策文档,逐轮修改。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

xlsx

读写 Excel 和 CSV,处理公式、格式、图表与数据清洗。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

canvas-design

按设计理念生成海报和视觉作品,输出 PNG 或 PDF。

ANanthropics/skills203k近 7 天新增 2,822 个 star