← Back to Skills Marketplace
duhuitech

度慧文档转换-文档转PDF

by duhuitech · GitHub ↗ · v1.0.5 · MIT-0
cross-platform ✓ Security Clean
135
Downloads
0
Stars
0
Active Installs
6
Versions
Install in OpenClaw
/install duhui-all-to-pdf
Description
当需要通过阿里云市场的度慧文档转换将单个本地文档转换为 PDF 时,请使用此 skill。凡是请求中提到“度慧”、“文档转PDF”、“doc to pdf”、“文档转换”、“格式转换”、“文档格式转换”或“PDF转换”,或者需要通过异步 API 将单个本地 Office/WPS/OFD/图片/文本/网页等任意文件...
README (SKILL.md)

度慧文档转PDF

Overview

用这个 skill 处理“单个本地文件转单个 PDF”的度慧异步转换任务。 标准链路是:本地文件 -> 阿里云 OSS 临时上传 -> 把 OSS 对象直链放进 input -> v2/convert_async -> 轮询查询 -> 下载本地 PDF -> 删除 OSS 临时文件。

Required Runtime And Secret

  • 必需二进制:python3
  • Python 侧只依赖标准库,不需要额外安装第三方包
  • 必需环境变量:DUHUI_ALI_APPCODE
  • AppCode 获取地址:https://market.aliyun.com/detail/cmapi00044564
  • 在运行转换脚本前,agent 必须确保 DUHUI_ALI_APPCODE 已出现在执行环境中
  • 本 skill 不规定 secret 的存储、检索或注入方式;这由用户自己的 agent 能力和授权策略决定

Network Endpoints

  • https://file.duhuitech.com/k/tmp_up.json:运行时获取临时 OSS 上传凭证
  • https://fmtmp.oss-cn-shanghai.aliyuncs.com:vendor 控制的临时 OSS 桶,用于上传本地源文件
  • https://doc2pdf.market.alicloudapi.com/v2/convert_async:提交异步转换请求
  • https://api.duhuitech.com/q:轮询转换状态
  • vendor 返回的 pdfurl:下载输出 PDF

Data Flow And Privacy

  • 本地源文件会先上传到阿里云 OSS 上海地域临时桶 fmtmp.oss-cn-shanghai.aliyuncs.com
  • 上传完成后会把 OSS 对象 URL 传给 vendor 的异步转换接口
  • 脚本会在运行时从 https://file.duhuitech.com/k/tmp_up.json 获取临时上传凭证,仅供当前进程使用
  • 转换结束后会 best-effort 删除 OSS 临时源文件;如果删除失败,远端源文件可能短暂残留
  • agent 不得在聊天、日志或最终答复里回显 AppCode
  • agent 只有在用户明确同意在聊天里直接粘贴 AppCode
  • agent 只有在用户明确同意且其自身 secret 管理策略允许时,才能持久化或缓存 AppCode

When To Use

  • 用户明确提到度慧、文档转 PDF、文档转换、格式转换、PDF 转换、压缩pdf,PDF水印
  • 用户要把单个本地 doc/docx/ppt/pptx/xls/xlsx/ofd/img/txt/html/... 文件转成 PDF
  • 任务需要走度慧的异步接口,而不是本地 LibreOffice 或其他转换器

Do Not Use

  • 直接 URL 输入
  • Base64 输入
  • 回调 URL

Workflow

  1. 先确认运行前置条件。
    • 运行环境必须可用 python3
    • 只检查环境变量 DUHUI_ALI_APPCODE
    • 如果环境变量已经存在,直接运行转换脚本;不要要求用户重复输入 AppCode。
    • 如果环境变量不存在,必须明确告诉用户:当前执行环境缺少 DUHUI_ALI_APPCODE,请先到阿里云市场商品页获取 AppCode:https://market.aliyun.com/detail/cmapi00044564。不要只笼统地说“请提供 AppCode”。
    • agent 应引导用户通过其支持的安全 secret 配置机制、环境变量机制或本地 secret store 来配置 DUHUI_ALI_APPCODE。如果 agent 支持安全的非聊天式 secret 输入,可指导用户使用该机制。
    • 只有在 agent 无法安全提供 DUHUI_ALI_APPCODE 且用户尚未完成配置时,才停止执行并等待用户完成配置。
  2. 默认优先运行脚本,不要手写 OSS 上传或 HTTP 调用逻辑:
python3 scripts/duhui_doc_to_pdf.py ./input.docx
  1. 用户指定输出路径时,加 --output
python3 scripts/duhui_doc_to_pdf.py ./input.docx --output ./output.pdf
  1. 默认会覆盖同名输出 PDF;如果用户要保留旧结果,显式指定另一个 --output 路径。
  2. 只有在文件后缀缺失、错误、或需要强制覆盖源类型时才传 --type
  3. 需要 vendor v2 可选参数时,用 --extra-params '\x3Cjson>' 透传,例如:
python3 scripts/duhui_doc_to_pdf.py ./input.docx --extra-params '{"pagesize":2,"compress":1}'
  1. 绝不在聊天、日志或最终答复里回显 AppCode 或脚本内置的 OSS 凭证;持久化时也只用占位符,不要把秘密再次展示出来。
  2. 当需要确认支持格式、把用户的细化要求映射成更多 v2 参数、查看 vendor 参数细节、或排查 vendor 返回字段时,读取 references/doc_to_pdf_ali.md

Missing AppCode Prompt

  • DUHUI_ALI_APPCODE 缺失时,优先使用类似下面的提示,而不是直接中止:
当前执行环境缺少 DUHUI_ALI_APPCODE。
请先到阿里云市场商品页获取度慧文档转 PDF 的 AppCode:
https://market.aliyun.com/detail/cmapi00044564

请改用你当前 agent 支持的安全 secret 配置方式、环境变量机制或本地 secret store 完成配置;配置完成后再继续转换。

Output Contract

  • 进度信息只写到 stderr
  • stdout 只输出一个 JSON
  • 成功 JSON 包含:status, token, output_path, pdf_url, page_count, filesize, source_object_key
  • 失败 JSON 包含:status, stage, token, reason

Notes

  • 脚本始终只处理一个本地输入文件
  • 脚本只使用 Python 标准库,不依赖额外 Python 包
  • OSS 对象名固定为 up/\x3Cuuid4>\x3C原扩展名>
  • 运行时会从 https://file.duhuitech.com/k/tmp_up.json 请求临时 OSS 上传凭证
  • 上传后直接把 OSS 对象 URL 传给 vendor,不生成签名 URL
  • 查询接口不带认证,固定每 2 秒轮询一次,最长等待 60 分钟
  • 转换结束后会尝试删除 OSS 临时源文件;删除失败只记 warning,不覆盖主错误
  • DUHUI_ALI_APPCODE 的存储、持久化、检索和注入由用户自己的 agent 负责
Usage Guidance
This skill appears to do what it claims, but it uploads your local file to a vendor-controlled OSS bucket and sends that OSS URL to Duhui's async convert API. Before installing/using: 1) Do not convert sensitive or confidential documents unless you are comfortable with the vendor seeing/storing them temporarily; the download URL may be publicly addressable. 2) Keep DUHUI_ALI_APPCODE in a secure secret store (do not paste it in chat); the skill expects it to be injected via your agent/environment. 3) Review the vendor's privacy/retention policy and the script if you need guarantees about deletion or retention windows (the script uses best-effort deletion and files may briefly remain). 4) If you need stronger guarantees, consider local conversion alternatives (LibreOffice, trusted on-prem converters). 5) Run the script in an isolated environment or sandbox if you want to limit exposure, and revoke the AppCode if you suspect misuse.
Capability Analysis
Type: OpenClaw Skill Name: duhui-all-to-pdf Version: 1.0.5 The skill is a legitimate tool for converting various document formats to PDF using the Duhui API on Alibaba Cloud Marketplace. The Python script (scripts/duhui_doc_to_pdf.py) implements a standard workflow: fetching temporary OSS credentials from the vendor, uploading the local file to a temporary Alibaba OSS bucket, triggering an asynchronous conversion via the Marketplace API, and downloading the result. The SKILL.md documentation clearly discloses that local files are uploaded to vendor-controlled storage and provides appropriate instructions for the AI agent to handle the required DUHUI_ALI_APPCODE secret securely. No evidence of data exfiltration (beyond the intended upload), malicious execution, or prompt injection was found.
Capability Assessment
Purpose & Capability
Name/description ask to convert a single local document to PDF via Duhui (Alibaba marketplace). The skill only requires python3 and DUHUI_ALI_APPCODE and uses the documented vendor endpoints. No unrelated cloud credentials or unrelated binaries are requested.
Instruction Scope
SKILL.md and the included script strictly describe: upload local file to a vendor-controlled OSS bucket (using temporary credentials fetched at runtime), POST the OSS URL to /v2/convert_async with Authorization: APPCODE, poll the vendor status endpoint, download the PDF, and attempt best-effort deletion of the temp object. The instructions do not read other system files or unrelated env vars. Note: uploading files to a vendor bucket (and exposing an OSS object URL) is a privacy-sensitive action documented by the skill.
Install Mechanism
Instruction-only install (no install spec). The package contains a python script but does not request external installers or download/execute unknown archives. No high-risk download URLs or extract operations are present in the install path.
Credentials
Only DUHUI_ALI_APPCODE is required, which is proportional (used to call the Alibaba marketplace convert_async API). The script also fetches short-lived OSS upload credentials from a vendor URL at runtime (documented). Those runtime credentials are used only in-process and the skill states it does not persist secrets to disk.
Persistence & Privilege
Skill is not always-on and is user-invocable; it does not request system-wide persistent privileges or edit other skills. It fetches temporary upload credentials at runtime but does not request persistent disk storage of secrets.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install duhui-all-to-pdf
  3. After installation, invoke the skill by name or use /duhui-all-to-pdf
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.5
Version 1.0.5 of duhui-all-to-pdf - No code or file changes detected. - Audit and behavioral instructions in SKILL.md updated: - Adjusted privacy and user notice terms regarding AppCode handling. - Removed the explicit required user disclosure before uploading, but core privacy practices remain. - Clarified agent behavior when handling DUHUI_ALI_APPCODE. - No changes to the technical workflow or skill usage.
v1.0.4
- Strengthened privacy and security requirements: the agent must not request secrets (AppCode) via chat, and should guide users to use secure configuration mechanisms. - Added mandatory user notice before uploading files, disclosing vendor cloud upload and possible data retention. - Updated workflow and prompts to emphasize secure secret handling and user consent before file upload. - No code or interface changes; documentation and policy updates only.
v1.0.3
No functional changes; documentation and user experience improvements. - SKILL.md now includes a more detailed, user-friendly prompt when `DUHUI_ALI_APPCODE` is missing, encouraging users to provide it directly in chat. - Clarifies that if a user sends the AppCode in chat, the agent should inject it and proceed, rather than stopping at configuration. - Minor updates to the skill name and description for clarity and trigger precision. - Streamlines and improves instructions and workflow guidance. - No code or behavior changes; this is a doc and UX update only.
v1.0.2
- Added structured frontmatter with homepage, compatibility details, and runtime metadata. - Explicitly documented required binaries, env vars, and all network endpoints. - Clarified that only Python standard library is needed (no extra packages). - Enhanced privacy/data-handling explanation in frontmatter and main docs. - Added note on ClawHub-compatible metadata and registry sync. - No code/script changes; documentation and metadata only.
v1.0.1
- Removed files related to AppCode persistence and helper script. - Changed required environment variable from DUHUI_DOC_TO_PDF_APPCODE to DUHUI_ALI_APPCODE. - Now mandates that the agent/user manages AppCode injection and storage; the skill no longer prescribes any helper script or persistence method. - Updated workflow and documentation to clarify that secret handling, environment setup, and AppCode privacy are fully agent/user responsibilities. - Simplified environment requirements; no longer provides or recommends shell command helpers for configuration.
v1.0.0
- Initial release of duhui-all-to-pdf: convert a single local Office, WPS, OFD, image, text, or web file to PDF via 度慧文档转换 (Alibaba Cloud). - Requires an AppCode from the Alibaba Cloud Market; instructions provided if not set. - Handles OSS uploading, async conversion, polling, and cleanup automatically via provided scripts. - Outputs only a single JSON result per conversion, with detailed error or success contract. - Secure handling: never echoes sensitive AppCode or credentials in any output or logs.
Metadata
Slug duhui-all-to-pdf
Version 1.0.5
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 6
Frequently Asked Questions

What is 度慧文档转换-文档转PDF?

当需要通过阿里云市场的度慧文档转换将单个本地文档转换为 PDF 时,请使用此 skill。凡是请求中提到“度慧”、“文档转PDF”、“doc to pdf”、“文档转换”、“格式转换”、“文档格式转换”或“PDF转换”,或者需要通过异步 API 将单个本地 Office/WPS/OFD/图片/文本/网页等任意文件... It is an AI Agent Skill for Claude Code / OpenClaw, with 135 downloads so far.

How do I install 度慧文档转换-文档转PDF?

Run "/install duhui-all-to-pdf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 度慧文档转换-文档转PDF free?

Yes, 度慧文档转换-文档转PDF is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 度慧文档转换-文档转PDF support?

度慧文档转换-文档转PDF is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 度慧文档转换-文档转PDF?

It is built and maintained by duhuitech (@duhuitech); the current version is v1.0.5.

💬 Comments