Document Tools
Рендерит ограниченный HTML в PDF
Вызовите этот инструмент из своего кода на трёх языках.
# 1) Upload each file first → returns { filePath }
curl -X POST 'https://api.elysiatools.com/upload/html-to-pdf-renderer' \
-F 'file=@/path/to/htmlFile.ext'
# 2) Call the tool with the returned filePath values
curl -X POST 'https://api.elysiatools.com/ru/api/tools/html-to-pdf-renderer' \
-F 'htmlContent=<h1 style='color:#1f2937'>Browser Mode</h1><p>Sample layout.</p>' \
-F 'htmlFile=/path/to/file.ext' \
-F 'url=https://example.com' \
-F 'baseUrl=https://example.com/docs/' \
-F 'cssContent=body { font-family: Arial, sans-serif; }' \
-F 'renderMode=browser' \
-F 'pageSize=A4' \
-F 'landscape=false' \
-F 'printBackground=true' \
-F 'scale=1' \
-F 'marginTop=20' \
-F 'marginBottom=20' \
-F 'marginLeft=20' \
-F 'marginRight=20' \
-F 'fontSize=12' \
-F 'lineHeight=1.5' \
-F 'mediaType=print' \
-F 'waitUntil=load' \
-F 'waitTime=0'Отправьте POST-запрос с входными данными в JSON. Параметры типа «файл» требуют предварительной загрузки.
POST https://api.elysiatools.com/ru/api/tools/html-to-pdf-renderer| Имя | Тип | Обязательный | Описание |
|---|---|---|---|
| htmlContent | textarea | Нет | — |
| htmlFile | fileнужна загрузка | Нет | — |
| url | text | Нет | — |
| baseUrl | text | Нет | — |
| cssContent | textarea | Нет | — |
| renderMode | select | Нет | — |
| pageSize | select | Нет | — |
| landscape | checkbox | Нет | — |
| printBackground | checkbox | Нет | — |
| scale | number | Нет | — |
| marginTop | number | Нет | — |
| marginBottom | number | Нет | — |
| marginLeft | number | Нет | — |
| marginRight | number | Нет | — |
| fontSize | number | Нет | — |
| lineHeight | number | Нет | — |
| mediaType | select | Нет | — |
| 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, чтобы ИИ-агенты могли перечислять и вызывать его.
Добавьте этот блок в конфигурацию вашего MCP-клиента:
{
"mcpServers": {
"elysiatools-html-to-pdf-renderer": {
"name": "html-to-pdf-renderer",
"description": "Рендерит ограниченный HTML в PDF",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=html-to-pdf-renderer",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}После подключения к SSE-endpoint выведите список доступных инструментов:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Вызовите инструмент по его id; аргументы формируются из его параметров:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "html-to-pdf-renderer",
"arguments": {
"htmlContent": "<h1 style='color:#1f2937'>Browser Mode</h1><p>Sample layout.</p>",
"htmlFile": "https://example.com/file.ext",
"url": "https://example.com",
"baseUrl": "https://example.com/docs/",
"cssContent": "body { font-family: Arial, sans-serif; }",
"renderMode": "browser",
"pageSize": "A4",
"landscape": false,
"printBackground": true,
"scale": 1,
"marginTop": 20,
"marginBottom": 20,
"marginLeft": 20,
"marginRight": 20,
"fontSize": 12,
"lineHeight": 1.5,
"mediaType": "print",
"waitUntil": "load",
"waitTime": 0
}
}
}Вопросы или проблемы? Свяжитесь с [email protected]