Skip to content

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:

ParameterTypeDefaultDescription
htmlstringRequiredThe HTML string to be rendered into a PDF.
formatstringa4The page size of the output PDF. Accepted values: letter, legal, tabloid, ledger, a0, a1, a2, a3, a4, a5, a6.
orientationstringportraitThe orientation of the PDF. Accepted values: portrait, landscape.
marginobject{}Defines the margins of the PDF. Includes top, right, bottom, and left (all in points). Default is 0 for all.
margin.topnumber0The top margin of the PDF in points.
margin.rightnumber0The right margin of the PDF in points.
margin.bottomnumber0The bottom margin of the PDF in points.
margin.leftnumber0The left margin of the PDF in points.

Example Request

HTTP Request

http
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 CodeDescription
400Bad Request: The input JSON is invalid or missing required fields.
500Internal 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 and orientation 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 TypeRate Limit (Requests per Minute)
Free30 requests / minute
Starter/Enterprise120 requests / minute

For additional support, contact our team at [email protected].