PDF页眉页脚片段
将HTML转换为PDF,并插入Logo/标题/日期等页眉页脚片段
渲染HTML为PDF,并插入可复用的页眉/页脚片段。
**支持片段:**
- Logo(图片上传)
- 标题文本
- 日期(ISO/本地/自定义)
- 可选页脚页码
**布局:**
- 左/中/右分区布局
- 配合页边距预留页眉页脚空间
API 文档
请求端点
POST /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 | 否 | - |
文件类型参数需要先通过 POST /upload/pdf-header-footer-snippets 上传获取 filePath,然后将 filePath 传递给对应的文件字段。
响应格式
{
"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)"
}
文件:
文件
AI MCP 文档
将此工具添加到您的 MCP 服务器配置中:
{
"mcpServers": {
"elysiatools-pdf-header-footer-snippets": {
"name": "pdf-header-footer-snippets",
"description": "将HTML转换为PDF,并插入Logo/标题/日期等页眉页脚片段",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=pdf-header-footer-snippets",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
你可以串联多个工具,比如:`https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`,最多20个。
支持 URL 文件链接或 Base64 编码作为文件参数。
如果遇见问题,请联系我们:[email protected]