文件转换器
文件转换器 (File Converter) 后端接口及具体任务参数规范,支持 HTML、Image、Keynote、Markdown、PDF、PPT/PPTX, Word 等格式之间的转换。
API 接口
文件转换任务是异步处理的。使用以下两个接口来创建和查询任务。点击右侧的“调试接口”打开交互式控制台。
POST
/tools/tasks
创建一个异步转换任务。表单参数中 type 值对应相应的工具 ID。
GET
/tools/tasks/:id
查询转换任务的执行状态,并在此任务完成后通过 result.url 获取最终输出的下载链接。
请求头
| 请求头 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
Authorization |
String |
是 | Bearer <YOUR_API_KEY> — 您的开发者 API 密钥。 |
Content-Type |
String |
是 (POST) | 必须为 multipart/form-data。 |
POST 请求体参数 (Form Data)
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
files |
File |
是 | 要处理的源文件。支持上传多个文件。 |
type |
String |
是 | 任务类型标识符。例如:convertor.ppt2pdf。 |
params |
String (JSON) |
否 | 工具特定参数的 JSON 字符串。默认为空 JSON 字符串 "{}"。 |
notifyURL |
String |
否 | Webhook 回调 URL,用于接收任务状态更新通知。 |
任务参数说明
文件转换器分类下的具体任务类型标识、格式与大小限制、以及特定请求参数 (params) 如下:
| 工具名称 (UI 展示) | Tool ID | Backend Task 类型 (type) | 接受的格式扩展名 (accept) | 单个文件大小上限 | Special 参数名s (params) |
|---|---|---|---|---|---|
| HTML to PNG | html2png | convertor.html2png | .html, .htm | 50 MB | {} *支持直接粘贴 HTML 代码作为文件输入* |
| HTML to PPTX | html2pptx | convertor.html2pptx | .html, .htm | 50 MB | {"needEmbedFonts": boolean} *是否在生成的 PPTX 中嵌入字体。支持粘贴 HTML* |
| Image to WebP | image-convert-webp | image.convertWebp | image/* | 100 MB | {} |
| Keynote to HTML | keynote2html | convertor.keynote2html | .key | 300 MB | {} |
| Keynote to Image | keynote2image | convertor.keynote2image | .key | 300 MB | {} |
| Keynote to PDF | keynote2pdf | convertor.keynote2pdf | .key | 300 MB | {} |
| Markdown to Image | markdown2png | convertor.markdown2png | .md, .markdown | 10 MB | {} *支持直接粘贴 Markdown 文本作为文件输入* |
| PDF to Image | pdf2image | convertor.pdf2image | .pdf | 300 MB | {} |
| PPT to PPTX | ppt2pptx | convertor.ppt2pptx | .ppt | 300 MB | {} |
| PowerPoint to PDF | ppt2pdf | convertor.ppt2pdf | .ppt, .pptx | 300 MB | {} |
| PowerPoint to Image | ppt2image | convertor.ppt2image | .ppt, .pptx | 300 MB | {} |
| PowerPoint to Video | ppt2video | convertor.ppt2video | .ppt, .pptx | 300 MB | {} |
| Word to PDF | doc2pdf | convertor.doc2pdf | .doc, .docx | 300 MB | {} |