Node.js, Python, PHP, Ruby, Go — one REST API for all.
HTML2DocHub works with any server-side language. No browser binary installation. No Docker configuration. Just HTTP requests. Generate PDFs and images from HTML on any backend — serverless, containers, VMs — from ₹0.10/page.
<?php
$ch = curl_init("https://api.html2dochub.com/v1/render");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: sk_live_YOUR_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"type" => "pdf",
"html" => "<h1>Hello PHP</h1>",
"options" => ["format" => "A4"],
]),
]);
$response = json_decode(curl_exec($ch), true);
echo $response["download_url"];require "net/http"
require "json"
require "uri"
uri = URI("https://api.html2dochub.com/v1/render")
req = Net::HTTP::Post.new(uri, {
"Content-Type" => "application/json",
"X-API-Key" => "sk_live_YOUR_KEY",
})
req.body = { type: "pdf", html: "<h1>Hello Ruby</h1>", options: { format: "A4" } }.to_json
resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(req) }
data = JSON.parse(resp.body)
puts data["download_url"]package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func renderPDF(html string) (string, error) {
body, _ := json.Marshal(map[string]any{
"type": "pdf",
"html": html,
"options": map[string]any{"format": "A4"},
})
req, _ := http.NewRequest("POST", "https://api.html2dochub.com/v1/render", bytes.NewBuffer(body))
req.Header.Set("X-API-Key", "sk_live_YOUR_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { return "", err }
defer resp.Body.Close()
var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
return result["download_url"].(string), nil
}Pay only for pages rendered. No subscriptions. No minimum monthly fee.
Free account. No credit card required. API ready in minutes.
Get your free API key