Media
将AVIF图像转换为PDF格式,支持自定义页面大小、方向和质量设置
用三种语言从你的代码中调用此工具。
# 1) Upload each file first → returns { filePath }
curl -X POST 'https://api.elysiatools.com/upload/avif-to-pdf' \
-F 'file=@/path/to/imageFile.ext'
# 2) Call the tool with the returned filePath values
curl -X POST 'https://api.elysiatools.com/zh/api/tools/avif-to-pdf' \
-F 'imageFile=/path/to/file.ext' \
-F 'pageSize=A4' \
-F 'orientation=portrait' \
-F 'quality=80' \
-F 'backgroundColor=white' \
-F 'margin=10' \
-F 'title=输入文档标题...' \
-F 'author=输入作者姓名...' \
-F 'subject=输入文档主题...' \
-F 'keywords=输入关键词...' \
-F 'fitMode=contain' \
-F 'centerImage=true' \
-F 'preserveAspectRatio=true'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/avif-to-pdf| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| imageFile | file需先上传 | 是 | — |
| pageSize | select | 否 | PDF文档页面大小 |
| orientation | select | 否 | PDF页面方向 |
| quality | select | 否 | 嵌入图像的质量设置 |
| backgroundColor | select | 否 | PDF页面背景颜色 |
| margin | range | 否 | 页面边距(页面大小的百分比) |
| title | text | 否 | PDF文档标题元数据 |
| author | text | 否 | PDF文档作者元数据 |
| subject | text | 否 | PDF文档主题元数据 |
| keywords | text | 否 | PDF文档关键词(逗号分隔) |
| fitMode | select | 否 | 图像如何在页面内适应 |
| centerImage | checkbox | 否 | 在页面上居中图像 |
| preserveAspectRatio | checkbox | 否 | 保持原始图像比例 |
文件结果
{
"filePath": "/public/processing/randomid.ext",
"fileName": "output.ext",
"contentType": "application/octet-stream",
"size": 1024,
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-avif-to-pdf": {
"name": "avif-to-pdf",
"description": "将AVIF图像转换为PDF格式,支持自定义页面大小、方向和质量设置",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=avif-to-pdf",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "avif-to-pdf",
"arguments": {
"imageFile": "https://example.com/file.ext",
"pageSize": "A4",
"orientation": "portrait",
"quality": "80",
"backgroundColor": "white",
"margin": 10,
"title": "输入文档标题...",
"author": "输入作者姓名...",
"subject": "输入文档主题...",
"keywords": "输入关键词...",
"fitMode": "contain",
"centerImage": true,
"preserveAspectRatio": true
}
}
}有问题或反馈?请联系 [email protected]