Document Tools
Renderiza um subconjunto de HTML em PDF
Chame esta ferramenta a partir do seu código em três idiomas.
# 1) Request a presigned URL → returns { uploadUrl, storageKey }
curl -X POST 'https://api.elysiatools.com/api/upload/presign/html-to-pdf-renderer' \
-H 'Content-Type: application/json' \
-d '{"filename":"htmlFile.ext","contentType":"application/octet-stream","size":12345}'
# 2) PUT the file bytes directly to the presigned uploadUrl
curl -X PUT '<presigned uploadUrl>' \
--data-binary @/path/to/file.ext
# 3) Call the tool, passing the returned storageKey for each file field
curl -X POST 'https://api.elysiatools.com/pt/api/tools/html-to-pdf-renderer' \
-F 'htmlContent=<h1 style='color:#1f2937'>Browser Mode</h1><p>Sample layout.</p>' \
-F 'htmlFile=uploads/2026/01/01/your-tool-1700000000000-abc123.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'Envie uma requisição POST com suas entradas em JSON. Parâmetros do tipo arquivo exigem upload prévio.
POST https://api.elysiatools.com/pt/api/tools/html-to-pdf-renderer| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| htmlContent | textarea | Não | — |
| htmlFile | fileupload necessário | Não | — |
| url | text | Não | — |
| baseUrl | text | Não | — |
| cssContent | textarea | Não | — |
| renderMode | select | Não | — |
| pageSize | select | Não | — |
| landscape | checkbox | Não | — |
| printBackground | checkbox | Não | — |
| scale | number | Não | — |
| marginTop | number | Não | — |
| marginBottom | number | Não | — |
| marginLeft | number | Não | — |
| marginRight | number | Não | — |
| fontSize | number | Não | — |
| lineHeight | number | Não | — |
| mediaType | select | Não | — |
| waitUntil | select | Não | — |
| waitTime | number | Não | — |
Resultado de arquivo
{
"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)"
}Adicione esta ferramenta ao seu servidor Model Context Protocol para que agentes de IA possam listá-la e chamá-la.
Adicione este bloco à configuração do seu cliente MCP:
{
"mcpServers": {
"elysiatools-html-to-pdf-renderer": {
"name": "html-to-pdf-renderer",
"description": "Renderiza um subconjunto de HTML em PDF",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=html-to-pdf-renderer",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}Após conectar ao endpoint SSE, liste as ferramentas expostas:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoque a ferramenta pelo seu id; os argumentos são construídos a partir de seus parâmetros:
{
"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
}
}
}Dúvidas ou problemas? Contate [email protected]