本地命令行把 PDF 与图片转换为 10 种结构化格式,基于 ComPDFKit Python SDK 封装。
设计与多媒体
PDF Extract
通过 ComPDF Cloud API 执行 50 多种 PDF 与文档处理操作。
它能做什么
该技能封装 ComPDF Cloud 的 REST API,覆盖 PDF 与 Word、Excel、图片、Markdown 之间的格式转换,以及合并、拆分、水印、压缩等页面编辑,同时支持 OCR 与 AI 文档提取、文档解析。每次调用都会把文件上传到 ComPDF 服务器,因此上传前需要用户明确授权,处理结果以同步方式返回,并附带次日 24:00 过期的下载链接。API Key 仅在用户主动同意后写入本地配置文件,技能同时提供国际版(api-server.compdf.com)和国内版(api-server.compdf.cn)两个接入地址,并遵循服务商每月 200 个文件的免费额度限制。
什么时候用它
- PDF 与 Word、Excel、图片、Markdown 格式互转
- 合并、拆分、加水印、压缩 PDF
- 对扫描件或图片执行 OCR 与 AI 文档提取
- 处理加密 PDF 时通过密码字段解密上传
技能文档
PDF Extract
Process PDF files through ComPDF Cloud REST API. Supports 50+ document processing operations.
Official documentation:
When to Run
- User requests to convert file format (e.g., "convert this PDF to Word", "convert Excel to PDF")
- User requests to edit PDF pages (e.g., "merge these two PDFs", "delete page 3", "rotate PDF")
- User requests to add or remove watermarks from PDF
- User requests to compress PDF files
- User requests OCR recognition of scanned documents or text in images
- User requests AI extraction or parsing of document content
- User requests to extract tables from images
- User requests batch processing of multiple document files
- User requests to compare differences between two PDF documents
- User mentions ComPDF, compdf, or related keywords
Workflow
Step 1 — Obtain API Key
Check whether config/public_key.txt exists and contains a non-empty value.
- If the file exists and is non-empty: use the stored key (trim whitespace).
- If the file is missing or empty: ask the user for their ComPDF API Public Key. Inform them it can be obtained at . After the user provides the key, ask whether they would like to save it locally for future sessions.
- If the user agrees, write the key to
config/public_key.txt. - If the user declines, use the key for the current session only without saving.
- If the user agrees, write the key to
The key file is not included in the published skill package. It is created at runtime only when the user explicitly opts in. The user may delete
config/public_key.txtat any time to revoke local storage.
Step 2 — Confirm External Upload Intent
Before uploading any file, explicitly inform the user:
⚠️ External Upload Confirmation Required
Your file will be uploaded to ComPDF's servers (api-server.compdf.com or api-server.compdf.cn) for processing. Please confirm that:
- You consent to uploading this file to external servers.
- The file does not contain highly sensitive or confidential data, or you accept the associated risk.
- You have reviewed ComPDF's Privacy Policy at .
Only proceed with the upload after receiving explicit user confirmation.
Step 3 — Determine Base URL
Ask or infer the user's network environment:
| Environment | Base URL |
|---|---|
| International | https://api-server.compdf.com/server/v2 |
| Mainland China | https://api-server.compdf.cn/server/v2 |
Step 4 — Select Tool
Look up the executeTypeUrl for the user's task in references/tool-list.md.
Quick reference for common operations:
| Operation | executeTypeUrl |
|---|---|
| PDF → Word | pdf/docx |
| PDF → Excel | pdf/xlsx |
| PDF → Image | pdf/img |
| PDF → Markdown | pdf/markdown |
| Word → PDF | docx/pdf |
| Merge PDF | pdf/merge |
| Split PDF | pdf/split |
| Add Watermark | pdf/addWatermark |
| PDF Compression | pdf/compress |
| OCR | documentAI/ocr |
| AI Document Extraction | idp/documentExtract |
| AI Document Parsing | idp/documentParsing |
For the full list of 50+ tools, see references/tool-list.md.
Step 5 — Build Parameters (optional)
If the selected tool supports custom parameters, look up its JSON schema in references/parameters.md. Parameters are passed as a JSON string in the parameter form-data field. If omitted, server defaults apply.
Step 6 — Send Request
After the user has explicitly confirmed the external upload:
- Send a
POSTrequest to{baseUrl}/process/{executeTypeUrl}. - Include the user-provided API key in the
x-api-keyheader for the current session only. - Send the selected file as multipart form-data.
- Include the
parameterfield only when the selected tool supports custom parameters. - Use the synchronous
/process/endpoint so the complete result is returned in a single response.
Do not send the request until the user has confirmed that the file may be transmitted to ComPDF Cloud.
Step 7 — Handle Response
1. Check code field — "200" means success; anything else is an error.
2. Check taskStatus (should be TaskFinish for synchronous calls):
| Status | Meaning | Action |
|---|---|---|
TaskFinish | Processing complete | Proceed to download |
TaskProcessing | Still processing internally | Notify user; suggest retrying shortly |
TaskOverdue | Timed out | Retry or split into smaller tasks |
3. Extract download link from fileInfoDTOList[].downloadUrl.
4. Warn the user: download links expire at 24:00 the next day.
5. On failure: read failureCode and failureReason, then look up troubleshooting advice in references/error-codes.md.
6. On quota exhaustion (code = "06001"): inform the user:
For more credits, please visit
Auxiliary Endpoints
| Purpose | Method & Path |
|---|---|
| List supported tools | GET {baseUrl}/tool/support |
| Check remaining credits | GET {baseUrl}/asset/info |
| List tasks | GET {baseUrl}/task/list?page=1&size=10 |
| Close a task | POST {baseUrl}/task/closeTask?taskId={taskId} |
Output Format
On success:
Processing complete!
File: {fileName} → {downFileName}
Status: {taskStatus}
Time taken: {convertTime}ms
Original size: {fileSize} bytes
Result size: {convertSize} bytes
Download link: {downloadUrl}
⚠️ The download link will expire at 24:00 tomorrow, please save it promptly.
On failure:
Processing failed.
Error code: {failureCode}
Reason: {failureReason}
Suggestion: {troubleshooting suggestion from references/error-codes.md}
Critical Rules
- HTTP 200 ≠ success — always check
codeandtaskStatusin the JSON body. - Max 5 files per task — split into multiple tasks if more files are needed.
- Free tier limit — 200 files within 30 days.
- File type auto-detection — the API detects uploaded file types; no need to rename extensions.
- Encrypted PDFs — provide the password in the
passwordform-data field (separate fromparameter). - China domain — mainland China users must replace
compdf.comwithcompdf.cn. - User-controlled API Key storage — the key file (
config/public_key.txt) is never shipped with the skill package. It is created at runtime only when the user explicitly opts in. The user may delete it at any time. - External upload confirmation — always obtain explicit user consent before uploading files to ComPDF servers.
License & Copyright
Copyright © 2014-2026 PDF Technologies, Inc., a KDAN Company. All Rights Reserved.
ComPDF and ComPDFKit are trademarks of PDF Technologies, Inc., a KDAN Company.
This skill package is licensed under the Apache License 2.0. See LICENSE.txt for the full license text.
The ComPDF Cloud API is a commercial service provided by PDF Technologies, Inc. Use of the API is subject to the ComPDF Terms of Service and Privacy Policy.
相关技能
基于 ComPDFKitConversion SDK,把 PDF 或图片转换为 Word、Excel、PPT、HTML 等 10 种可编辑格式。
把收到的发票归档并审核——OCR、去重校验、增值税分档与可检索的本地存档。
用提示词生成专业 PDF 与 DOCX 文档——涵盖简历、合同、报告、方案等多种类型。
基于 ComPDFKit 命令行引擎,完成 PDF 的合并、拆分、旋转、页面增删与标准格式转换。
通过 ComPDF Cloud REST API 处理 PDF 任务,支持 50+ 种文档操作。