AI Agent Hub
Back to skills
Duhui Document to PDF icon

Duhui Document to PDF

Office Efficiency Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_d9c601a2/duhui-all-to-pdf according to https://skillhub.cn/install/skillhub.md.

About this skill

Problem It Solves

This skill handles converting one local file to PDF through Duhui's asynchronous conversion service, including doc/docx, ppt/pptx, xls/xlsx, ofd, images, txt, and html. It is intended for tasks where the workflow requires the vendor API, such as PDF compression or PDF watermarking parameters, rather than local conversion with LibreOffice. It does not support direct URL input, Base64 input, or callback URLs.

How It Works

The runtime requires python3 and the DUHUI_ALI_APPCODE environment variable. The script follows the standard path: upload the local file to a temporary Shanghai OSS bucket, pass the OSS object URL to v2/convert_async, poll the status every 2 seconds for up to 60 minutes, download the resulting PDF, and delete the temporary remote file on a best-effort basis. Progress is written to stderr, while stdout emits a single JSON object; success includes output_path, pdf_url, page_count, and filesize.

Boundaries and Notes

  • The default behavior overwrites an existing PDF with the same name; use --output to keep the old result.
  • Use --type only when the file extension is missing, incorrect, or the source type must be forced.
  • Use --extra-params '' to pass optional vendor v2 parameters; check references/doc_to_pdf_ali.md for supported formats and field details.
  • Do not echo the AppCode or OSS credentials in chat, logs, or final output; a failed remote deletion only records a warning and may leave the source file temporarily.

Use Cases

  • Convert a single local Word contract file to PDF for delivery or archiving.
  • Turn a local Excel report into a PDF and write it to a specified output path.
  • Use Duhui's async API to convert one local OFD or HTML file into PDF.
  • Pass optional v2 parameters to add PDF watermarking or compression requirements.

Best For

  • Support engineers who ask an agent to convert one local Office file to PDF.
  • Automation developers who want to avoid hand-writing OSS upload and polling logic.
  • Document-processing engineers who need v2 parameters for PDF watermarking or compression.
  • Platform engineers maintaining Agent Skills workflows with clear I/O contracts.