PDF Rendering API Documentation
The PDF Rendering API allows you to render PDFs from HTML content quickly and efficiently. This documentation describes the endpoint, request structure, and how to use the service effectively.
Prerequisites
You'll need an API key to authenticate requests to the Renderize API. If you don't have one yet, you can sign up for a free account at Renderize. The API key should be included as a bearer token in the Authorization
header of your requests.
Endpoint
https://rndz.tech/api/v1/documents/pdf/html
Request Details
HTTP Method
POST /api/v1/documents/pdf/html
Request Body
The request body must be a JSON object with the following fields:
Parameter | Type | Default | Description |
---|---|---|---|
html | string | Required | The HTML string to be rendered into a PDF. |
format | string | a4 | The page size of the output PDF. Accepted values: letter , legal , tabloid , ledger , a0 , a1 , a2 , a3 , a4 , a5 , a6 . |
orientation | string | portrait | The orientation of the PDF. Accepted values: portrait , landscape . |
margin | object | {} | Defines the margins of the PDF. Includes top , right , bottom , and left (all in points). Default is 0 for all. |
margin.top | number | 0 | The top margin of the PDF in points. |
margin.right | number | 0 | The right margin of the PDF in points. |
margin.bottom | number | 0 | The bottom margin of the PDF in points. |
margin.left | number | 0 | The left margin of the PDF in points. |
Example Request
HTTP Request
POST /api/v1/documents/pdf/html HTTP/1.1
Host: rndz.tech
Content-Type: application/json
Authorization: Bearer <your-api-key>
{
"html": "<html><body><h1>Hello, World!</h1></body></html>",
"format": "a4",
"orientation": "portrait",
"margin": {
"top": 10,
"right": 15,
"bottom": 10,
"left": 15
}
}
Example Response
HTTP Status Code
200 OK
Response Body
The response will include the binary data of the generated PDF. Ensure your application handles this appropriately (e.g., saving the data as a .pdf
file).
Error Handling
Common Errors
Status Code | Description |
---|---|
400 | Bad Request: The input JSON is invalid or missing required fields. |
500 | Internal Server Error: An issue occurred while rendering the PDF. |
Notes
- HTML Input: Ensure the
html
string is properly formatted and contains valid HTML for optimal rendering. - Margins: Margins are specified in points (1 point = 1/72 inch). Use this to fine-tune the spacing.
- Customizing Output: Use the
format
andorientation
parameters to tailor the PDF layout to your needs.
Rate Limits
The PDF Rendering API has rate limits in place to prevent abuse. If you exceed the limits, you will receive a 429 Too Many Requests
response.
Plan Type | Rate Limit (Requests per Minute) |
---|---|
Free | 30 requests / minute |
Starter/Enterprise | 120 requests / minute |
For additional support, contact our team at [email protected].