HTML to PDF Converter API

Convert HTML content from n8n workflows to structured, responsive PDFs

API Usage

Endpoint

POST /convert

Request Format

{
  "html": "Your HTML content here",
  "filename": "output.pdf" // Optional
}

Response

A PDF file with the converted content

Example with cURL

curl -X POST \
  https://htmlpdfconverter.srv925302.hstgr.cloud/convert \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello, World!</h1>", "filename": "example.pdf"}' \
  --output example.pdf

n8n Integration

To integrate with n8n:

  1. Use an HTTP Request node in your n8n workflow
  2. Set the method to POST
  3. Set the URL to https://htmlpdfconverter.srv925302.hstgr.cloud/convert
  4. Set Headers: Content-Type: application/json
  5. In the Request Body, include your HTML content. Make sure to reference your HTML content from a previous node:
    {
      "html": "Your n8n variable with HTML content",
      "filename": "output.pdf"
    }

    Note: In n8n, you would typically use expression syntax to reference data from previous nodes

  6. To save the PDF file, use the Write Binary File node connected to the HTTP Request node

Test Converter

Features

  • Preserves HTML layout and design
  • Ensures responsive output for mobile and desktop
  • Handles tables, images, and text formatting
  • Simple API integration with n8n
  • Custom filename support
  • Proper page numbering
  • Error handling for malformed HTML