HTML to PDF
Convert HTML content to PDF documents.
Endpoint
POST https://www.acrewity.com/api/services/execute
Authentication
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
n8n Integration
This service is also available via our n8n community node: @acrewity/n8n-nodes-acrewity
Operations
Convert to PDF
Convert HTML content or URL to PDF
Operation ID: convert_pdf
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
html |
string | No | - | HTML content to convert |
url |
string | No | - | URL of web page to convert (alternative to HTML) |
format |
string | No | A4 |
Paper format Options: A4, Letter, Legal, A3, A5 |
landscape |
boolean | No | false |
Use landscape orientation |
margin |
object | No | { top: 20, bottom: 20, left: 20, right: 20 } |
Page margins (top, bottom, left, right) |
Note: Either html or url must be provided.
Example Request
HTML Content to PDF:
{
"service": "html-to-pdf",
"operation": "convert_pdf",
"parameters": {
"html": "<html><head><style>body { font-family: Arial; padding: 40px; } h1 { color: #333; } table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid #ddd; padding: 12px; }</style></head><body><h1>Invoice #2024-0892</h1><table><tr><th>Item</th><th>Amount</th></tr><tr><td>Web Design</td><td>$500.00</td></tr><tr><td>Logo Design</td><td>$150.00</td></tr></table><p><strong>Total: $650.00</strong></p></body></html>",
"format": "A4",
"margin": { "top": "20mm", "bottom": "20mm", "left": "15mm", "right": "15mm" }
}
}
URL to PDF:
{
"service": "html-to-pdf",
"operation": "convert_pdf",
"parameters": {
"url": "https://example.com/report",
"format": "Letter",
"landscape": true
}
}
Example Response
{
"success": true,
"result": {
"data": {
"filename": "document-1735567890123.pdf",
"contentType": "application/pdf",
"size": 45238,
"content": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PA...",
"downloadUrl": "/api/downloads/document-1735567890123.pdf",
"downloadable": true,
"metadata": {
"format": "A4",
"landscape": false,
"pageCount": "N/A",
"fileSize": 45238
}
}
},
"credits_used": 1
}
More Examples
See Document Processing Examples for complete workflow examples including invoices, reports, certificates, and contracts.