POSTConvert HTML
https://html-render.dataandapis.com/v1/convert
Corpo da requisição
{
"html": "<html><body><h1>Invoice #2025-001</h1><table><tr><th>Description</th><th>Qty</th><th>Total</th></tr><tr><td>HTML to PDF Conversion</td><td>10</td><td>$0.50</td></tr><tr><td>HTML to PNG Rendering</td><td>8</td><td>$0.32</td></tr><tr><td>Custom Branding</td><td>1</td><td>$4.99</td></tr></table><p>Total Due: $5.81</p></body></html>",
"format": "pdf",
"options": {
"format": "A4",
"printBackground": true,
"margin": {
"top": "20px",
"right": "20px",
"bottom": "20px",
"left": "20px"
}
}
}Exemplo de requisição
curl -X POST "https://html-render.dataandapis.com/v1/convert" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "html": "<html><body><h1>Invoice #2025-001</h1><table><tr><th>Description</th><th>Qty</th><th>Total</th></tr><tr><td>HTML to PDF Conversion</td><td>10</td><td>$0.50</td></tr><tr><td>HTML to PNG Rendering</td><td>8</td><td>$0.32</td></tr><tr><td>Custom Branding</td><td>1</td><td>$4.99</td></tr></table><p>Total Due: $5.81</p></body></html>", "format": "pdf", "options": { "format": "A4", "printBackground": true, "margin": { "top": "20px", "right": "20px", "bottom": "20px", "left": "20px" } } }'// npm install dataandapis
import { DataAndApis } from "dataandapis";
const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY
const file = await client.htmlRender.convertHtml({
body: {
html: "<html><body><h1>Invoice #2025-001</h1><table><tr><th>Description</th><th>Qty</th><th>Total</th></tr><tr><td>HTML to PDF Conversion</td><td>10</td><td>$0.50</td></tr><tr><td>HTML to PNG Rendering</td><td>8</td><td>$0.32</td></tr><tr><td>Custom Branding</td><td>1</td><td>$4.99</td></tr></table><p>Total Due: $5.81</p></body></html>",
format: "pdf",
options: {
format: "A4",
printBackground: true,
margin: { top: "20px", right: "20px", bottom: "20px", left: "20px" },
},
},
}); // a Blob# pip install dataandapis
from dataandapis import DataAndApis
client = DataAndApis() # reads DATAANDAPIS_API_KEY
file = client.html_render.convert_html(
body={
"html": "<html><body><h1>Invoice #2025-001</h1><table><tr><th>Description</th><th>Qty</th><th>Total</th></tr><tr><td>HTML to PDF Conversion</td><td>10</td><td>$0.50</td></tr><tr><td>HTML to PNG Rendering</td><td>8</td><td>$0.32</td></tr><tr><td>Custom Branding</td><td>1</td><td>$4.99</td></tr></table><p>Total Due: $5.81</p></body></html>",
"format": "pdf",
"options": {
"format": "A4",
"printBackground": True,
"margin": {
"top": "20px",
"right": "20px",
"bottom": "20px",
"left": "20px",
},
},
},
) # byteshttps://dataandapis.com/images/html-render-example.webp




