Document Tools
Convierte HTML a PDF con numeración romana, arábiga o con prefijo de capítulo
Llama a esta herramienta desde tu código en tres lenguajes.
curl -X POST 'https://api.elysiatools.com/es/api/tools/pdf-page-numbering-styles' \
-H 'Content-Type: application/json' \
-d '{"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":20,"marginBottom":20,"marginLeft":20,"marginRight":20,"numberingStyle":"arabic","startPageNumber":1,"includeTotalPages":true,"chapterPrefixTemplate":"Chapter {chapter} - ","chapterNumber":1,"labelPrefix":"Page ","labelSuffix":"","numberPosition":"footer-right","edgeOffsetMm":10,"fontSize":10,"fontColor":"#333333","waitUntil":"networkidle0","waitTime":0}'Envía una petición POST con tus entradas en JSON. Los parámetros de tipo archivo requieren una subida previa.
POST https://api.elysiatools.com/es/api/tools/pdf-page-numbering-styles| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| htmlContent | textarea | Sí | — |
| cssContent | textarea | No | — |
| pageSize | select | No | — |
| landscape | checkbox | No | — |
| printBackground | checkbox | No | — |
| marginTop | number | No | — |
| marginBottom | number | No | — |
| marginLeft | number | No | — |
| marginRight | number | No | — |
| numberingStyle | select | No | — |
| startPageNumber | number | No | — |
| includeTotalPages | checkbox | No | — |
| chapterPrefixTemplate | text | No | — |
| chapterNumber | number | No | — |
| labelPrefix | text | No | — |
| labelSuffix | text | No | — |
| numberPosition | select | No | — |
| edgeOffsetMm | number | No | — |
| fontSize | number | No | — |
| fontColor | color | No | — |
| waitUntil | select | No | — |
| waitTime | number | No | — |
Resultado de archivo
{
"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)"
}Añade esta herramienta a tu servidor Model Context Protocol para que los agentes de IA puedan listarla y llamarla.
Añade este bloque a la configuración de tu cliente MCP:
{
"mcpServers": {
"elysiatools-pdf-page-numbering-styles": {
"name": "pdf-page-numbering-styles",
"description": "Convierte HTML a PDF con numeración romana, arábiga o con prefijo de capítulo",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=pdf-page-numbering-styles",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}Tras conectar al endpoint SSE, lista las herramientas expuestas:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoca la herramienta por su id; los argumentos se construyen a partir de sus parámetros:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "pdf-page-numbering-styles",
"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": 20,
"marginBottom": 20,
"marginLeft": 20,
"marginRight": 20,
"numberingStyle": "arabic",
"startPageNumber": 1,
"includeTotalPages": true,
"chapterPrefixTemplate": "Chapter {chapter} - ",
"chapterNumber": 1,
"labelPrefix": "Page ",
"labelSuffix": "",
"numberPosition": "footer-right",
"edgeOffsetMm": 10,
"fontSize": 10,
"fontColor": "#333333",
"waitUntil": "networkidle0",
"waitTime": 0
}
}
}¿Dudas o problemas? Contacta con [email protected]