PDF API

Login

PDF API Usage Guide

Welcome to the PDF API! This page explains how to use the API to convert, upload, and manage PDF files. All endpoints are RESTful and return JSON responses.

Authentication

Endpoints

1. Convert HTML to PDF

POST https://renderkit.eu/api/conversions
  Content-Type: application/json
  Authorization: Bearer YOUR_API_KEY

  {
    "html": "<h1>Hello PDF!</h1>"
  }

Send a JSON POST request with an html key containing your HTML string.

The response will be JSON:

{
    "file": "https://renderkit.eu/path/to/file.pdf",
    "byte_size": 123456
  }

The file is a URL to the generated PDF, and byte_size is the file size in bytes.

2. Capture a Screenshot

POST https://renderkit.eu/api/screenshot
  Content-Type: application/json
  Authorization: Bearer YOUR_API_KEY

  {
    "url": "https://example.com"
  }

Render a screenshot of a live page with a url key, or of raw markup with an html key (one is required). The response has the same file / byte_size shape as above.

Optional parameters:

  • format - "png" (default), "jpeg", or "webp"
  • width - Viewport width in pixels
  • height - Viewport height in pixels
  • quality - Compression quality 0-100 (jpeg/webp)
  • omit_background - "true" or "false" - transparent background

3. Convert an Office Document to PDF

POST https://renderkit.eu/api/office_conversion
  Content-Type: multipart/form-data
  Authorization: Bearer YOUR_API_KEY

  file=@report.docx

Upload a document as multipart form data under the file field. Supported formats include docx, xlsx, pptx, and odt. The response has the same file / byte_size shape as above.

curl -X POST \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@report.docx" \
    https://renderkit.eu/api/office_conversion

Page properties

When converting HTML to PDF, you can customize the output using optional parameters in your request:

{
  "html": "<h1>Hello PDF!</h1>",
  "margin_top": "0.4",
  "margin_bottom": "0.4",
  "margin_left": "0.4",
  "margin_right": "0.4",
  "paper_width": "8.5",
  "paper_height": "11",
  "scale": "1.0",
  "orientation": "portrait",
  "single_page": "false",
  "print_background": "true",
  "omit_background": "false"
}

Available parameters:

  • margin_top - Top margin in inches (e.g., "0.4")
  • margin_bottom - Bottom margin in inches
  • margin_left - Left margin in inches
  • margin_right - Right margin in inches
  • paper_width - Paper width in inches (e.g., "8.5" for Letter)
  • paper_height - Paper height in inches (e.g., "11" for Letter)
  • scale - Scale factor (e.g., "1.0" for 100%)
  • orientation - "portrait" or "landscape"
  • single_page - "true" or "false" - force single page output
  • print_background - "true" or "false" - include background graphics
  • omit_background - "true" or "false" - omit default white background

Example: cURL Request

curl -X POST \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"html": "<h1>Hello PDF!</h1>"}' \
    https://renderkit.eu/api/conversions
  

Support

For help, contact support@renderkit.eu.