Document Tools
将HTML转换为PDF,并插入Logo/标题/日期等页眉页脚片段
用三种语言从你的代码中调用此工具。
# 1) Upload each file first → returns { filePath }
curl -X POST 'https://api.elysiatools.com/upload/pdf-header-footer-snippets' \
-F 'file=@/path/to/logoFile.ext'
# 2) Call the tool with the returned filePath values
curl -X POST 'https://api.elysiatools.com/zh/api/tools/pdf-header-footer-snippets' \
-F 'htmlContent=
<h1>Quarterly Report</h1>
<p>This is a generated test document.</p>
<div style="page-break-after: always;"></div>
<h2>Second Page</h2>
<p>More sample content.</p>
' \
-F 'cssContent=
body { font-family: Arial, sans-serif; }
h1, h2 { color: #1f2937; }
p { font-size: 12pt; }
' \
-F 'pageSize=A4' \
-F 'landscape=false' \
-F 'printBackground=true' \
-F 'marginTop=18' \
-F 'marginBottom=18' \
-F 'marginLeft=20' \
-F 'marginRight=20' \
-F 'headerEnabled=true' \
-F 'footerEnabled=true' \
-F 'logoFile=/path/to/file.ext' \
-F 'logoWidth=80' \
-F 'headerTitle=Quarterly Report' \
-F 'footerTitle=Internal' \
-F 'showDateInHeader=true' \
-F 'showDateInFooter=false' \
-F 'dateFormat=locale' \
-F 'customDateText=March 2026' \
-F 'showPageNumbers=true' \
-F 'waitUntil=networkidle0' \
-F 'waitTime=0'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/pdf-header-footer-snippets| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| htmlContent | textarea | 是 | — |
| cssContent | textarea | 否 | — |
| pageSize | select | 否 | — |
| landscape | checkbox | 否 | — |
| printBackground | checkbox | 否 | — |
| marginTop | number | 否 | — |
| marginBottom | number | 否 | — |
| marginLeft | number | 否 | — |
| marginRight | number | 否 | — |
| headerEnabled | checkbox | 否 | — |
| footerEnabled | checkbox | 否 | — |
| logoFile | file需先上传 | 否 | — |
| logoWidth | number | 否 | — |
| headerTitle | text | 否 | — |
| footerTitle | text | 否 | — |
| showDateInHeader | checkbox | 否 | — |
| showDateInFooter | checkbox | 否 | — |
| dateFormat | select | 否 | — |
| customDateText | text | 否 | — |
| showPageNumbers | checkbox | 否 | — |
| waitUntil | select | 否 | — |
| waitTime | number | 否 | — |
文件结果
{
"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-pdf-header-footer-snippets": {
"name": "pdf-header-footer-snippets",
"description": "将HTML转换为PDF,并插入Logo/标题/日期等页眉页脚片段",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=pdf-header-footer-snippets",
"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": "pdf-header-footer-snippets",
"arguments": {
"htmlContent": "\n<h1>Quarterly Report</h1>\n<p>This is a generated test document.</p>\n<div style=\"page-break-after: always;\"></div>\n<h2>Second Page</h2>\n<p>More sample content.</p>\n",
"cssContent": "\nbody { font-family: Arial, sans-serif; }\nh1, h2 { color: #1f2937; }\np { font-size: 12pt; }\n",
"pageSize": "A4",
"landscape": false,
"printBackground": true,
"marginTop": 18,
"marginBottom": 18,
"marginLeft": 20,
"marginRight": 20,
"headerEnabled": true,
"footerEnabled": true,
"logoFile": "https://example.com/file.ext",
"logoWidth": 80,
"headerTitle": "Quarterly Report",
"footerTitle": "Internal",
"showDateInHeader": true,
"showDateInFooter": false,
"dateFormat": "locale",
"customDateText": "March 2026",
"showPageNumbers": true,
"waitUntil": "networkidle0",
"waitTime": 0
}
}
}有问题或反馈?请联系 [email protected]