Pdf To Markdown

PSPDFKit-labs/nutrient-skills/plugins/pdf-to-markdown/skills/pdf-to-markdown

作者 PSPDFKit-labs74a4ff0cde9ce40ca96d4dc433eee0988235ff4dProprietary收录于 2026年10月9日更新于 2026年10月9日

Convert PDF content to structured Markdown for analysis or AI workflows. Use this skill whenever a user needs text or Markdown from a PDF. Use Standard for PDFs with selectable text and Vision for scans or visually complex pages. Use pdf-to-text instead when whitespace and column alignment must be preserved.

仅含说明Documents & Office
AI 生成的概览

将 PDF 文件转换为结构化 Markdown,并提供用于扫描件和复杂版式的 Vision 模式。

功能
封装 Nutrient CLI,将 PDF 转换为 Markdown,同时保留标题、表格、列表和阅读顺序。支持单文件转换、批量目录转换、可选的图片导出,以及面向扫描件、手写、公式和复杂版式的 Vision 模式。文档还说明了账户、许可、离线和故障排查行为。
适用场景
当用户需要从 PDF 中提取文本或 Markdown 用于分析或 AI 工作流时使用。对含可选文本的 PDF 选择 Standard,对扫描件或视觉复杂的页面选择 Vision。当列对齐比 Markdown 结构更重要时,改用保留空白的替代方案。
运行要求
附带包装脚本,首次使用时从 CDN 下载 Nutrient CLI 并在本地缓存。Standard 转换无需账户;Vision 需要 Nutrient 账户、API 密钥或 CLI 许可证密钥,并且首次下载和 Vision 调用需要网络访问。

Rules for agents

  • Convert each PDF once and save the result. Search the saved file instead of converting it again.
  • For a known term, start with a bounded search such as grep -n -i -C2 "term" file | head.
  • Use the query skill when you do not know the exact wording or a plain search returns too many matches.
  • Use pdf-to-text when whitespace and column alignment matter more than Markdown structure.
  • Do not render PDF pages as images to extract selectable text. Use Vision for scans and image-only PDFs.

PDF to Markdown

Convert PDFs to Markdown while preserving headings, tables, lists, and reading order.

Related skills

  • pdf-to-text — preserves whitespace and column alignment in plain text.
  • query — searches a large converted file and returns only the most relevant passages.

Usage

Set SKILL_DIR to the absolute path of the directory containing this file. Use $SKILL_DIR/bin/pdf-to-markdown in the commands below.

The wrapper downloads the CLI from Nutrient's CDN on first use and stores it in ~/.local/share/nutrient/cli/. It checks for updates every six hours.

Convert one PDF

bash
$SKILL_DIR/bin/pdf-to-markdown INPUT.pdf OUTPUT.md

Omit OUTPUT.md to write Markdown to stdout.

Convert several PDFs

For two or more PDFs, pass an input directory and an output directory. The CLI converts the files in parallel.

bash
$SKILL_DIR/bin/pdf-to-markdown INPUT_DIR/ OUTPUT_DIR/

Export images

Add --enable-image-export to save images next to the Markdown output and link to them from the file.

bash
$SKILL_DIR/bin/pdf-to-markdown --enable-image-export INPUT.pdf OUTPUT.md

Images are stored in {output}_resources/. Image export is off by default because it adds work for image-heavy PDFs.

Use Vision

Vision handles scans, photographs, handwriting, formulas, and complex layouts.

bash
$SKILL_DIR/bin/pdf-to-markdown --vision INPUT.pdf OUTPUT.md

Standard conversion is free and does not require an account. Vision requires a Nutrient account, an API key, or a Nutrient CLI license key. With an account or API key, each input page uses one Vision page from the account's monthly allowance. Nutrient CLI license keys keep their existing terms. Failed conversions do not use Vision pages.

If Vision asks for an account, show that message to the user and ask them to run:

bash
$SKILL_DIR/bin/nutrient auth login

Do not start sign-in automatically. Do not retry Vision without authentication.

For unattended use, the user can set NUTRIENT_API_KEY. Never ask the user to paste a key into chat or put it directly in a command.

Account commands

bash
$SKILL_DIR/bin/nutrient auth login$SKILL_DIR/bin/nutrient auth status$SKILL_DIR/bin/nutrient auth logout

status shows the current plan, Vision access, and usage waiting to be reported. Never sign out or switch accounts unless the user asks.

Workflow

  1. Choose Standard or Vision. Start with Standard unless the PDF is scanned or image-only.
  2. Convert the PDF once and check the exit code. Exit 0 means success.
  3. Check that the output exists and is not empty.
  4. Tell the user where the output was saved.
  5. Do not read a large output file back into context unless the user wants it analyzed. Search it with bounded grep or the query skill instead.

Offline behavior

Standard can continue when Nutrient is unavailable. After Vision connects, it can work offline for one hour and process up to 100 pages before it must reconnect. A document that crosses the 100-page threshold can finish.

Troubleshooting

  • Empty or minimal output: The PDF may be scanned or image-only. Offer Vision.
  • Vision asks for sign-in: Show the CLI message and ask the user to run $SKILL_DIR/bin/nutrient auth login. Do not retry first.
  • No Vision pages remain: Show the CLI message and the pricing page. Do not retry or change account state.
  • Credential error during Standard conversion: An explicitly configured key or saved sign-in is invalid. Show the error. Do not remove or replace credentials unless the user asks.
  • First run is slow: The wrapper downloads the platform binary once. Later runs use the cached copy.
  • Other nonzero exit: Read stderr and report the specific error. Common causes include a damaged PDF, unsupported encryption, or a first-run download failure.

Plans and licensing

Standard conversion is free. With an account or API key, Vision uses the account's monthly allowance. Nutrient CLI license keys keep their existing terms. See current plans.

Use is subject to the Nutrient PDF to Markdown License and Nutrient's Privacy Policy. Redistribution, OEM, embedded, and white-label use require a separate agreement with Nutrient.

来源与署名

来源:PSPDFKit-labs/nutrient-skills位于plugins/pdf-to-markdown/skills/pdf-to-markdown提交74a4ff0

许可证: Proprietary

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架