Stop struggling with PDF generation, focus on your core business
Whether you need invoices for your e-commerce or advanced reports for your startup, leave the PDF generation to us and stay focused on what matters most.
Choosing the right PDF generation tool is time-consuming. HTML-to-PDF is a pragmatic approach that lets you reuse technologies you already know (HTML, CSS, and JS) to build professional documents.
Use technologies that your team already knows — get it done today.
Get a PDF with just one HTTP call or tune all the settings if you want.
We handle your data with care and we don't keep any.
Don't fear high traffic spikes, we can handle any load or burst.
Family business or planet-scale company, we have a plan for you.
We put our customers first — get in touch anytime you need help.
Creating PDF is as easy as printing a webpage in your browser — behind the scenes we do just that!
You could do the same using open-source tools, but you'd have to deploy and maintain your own instances of Chromium, which is known to be resource-intensive.
With a vertical focus on this task, we've invested our time perfecting the infrastructure for you. We rely on AWS cloud to deliver a robust, fast, and scalable service.
Generate PDF documents with a simple API call
curl --request POST \
--url https://pdf-converter.example.com/pdf \
--header 'content-type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{
"pdf": {
"format": "A4",
"margin": {"top": "1cm", "right": "1cm", "bottom": "1cm", "left": "1cm"},
"printBackground": true
},
"source": {
"html": "<!DOCTYPE html><html><head><style>body{font-family:Arial;color:#333}h1{color:#2563eb}table{width:100%;border-collapse:collapse}th,td{border:1px solid #e5e7eb;padding:8px}th{background:#f9fafb}</style></head><body><h1>Invoice #12345</h1><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Qty</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td colspan=3 style=\'text-align:right\'><strong>Total:</strong></td><td>$50.00</td></tr></table></body></html>"
}
}' > invoice.pdf
import requests
url = "https://pdf-converter.example.com/pdf"
# HTML template for the invoice (all in one line for compactness)
html_template = '<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;color:#333;line-height:1.5}h1{color:#2563eb;border-bottom:1px solid #e5e7eb;padding-bottom:10px}table{width:100%;border-collapse:collapse;margin-top:20px}th,td{border:1px solid #e5e7eb;padding:8px;text-align:left}th{background-color:#f9fafb}.total{font-weight:bold;text-align:right}</style></head><body><h1>Invoice #12345</h1><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Quantity</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td>Service B</td><td>1</td><td>$75.00</td><td>$75.00</td></tr><tr><td colspan="3" class="total">Total:</td><td>$125.00</td></tr></table><p>Thank you for your business!</p></body></html>'
payload = {
"pdf": {
"format": "A4",
"margin": {"top": "1cm", "right": "1cm", "bottom": "1cm", "left": "1cm"},
"printBackground": True
},
"source": {
"html": html_template
}
}
headers = {
"content-type": "application/json",
"x-api-key": "YOUR_API_KEY"
}
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
with open('invoice.pdf', 'wb') as f:
f.write(response.content)
print("PDF invoice generated successfully!")
else:
print(f"Error: {response.status_code}, {response.text}")
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://pdf-converter.example.com/pdf',
headers: {
'content-type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
data: {
pdf: {
format: 'A4',
margin: { top: '1cm', right: '1cm', bottom: '1cm', left: '1cm' },
printBackground: true
},
source: {
html: '<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;margin:0;padding:20px;color:#333}h1{color:#2563eb;border-bottom:1px solid #e5e7eb;padding-bottom:10px}.invoice-details{margin-top:20px;border:1px solid #e5e7eb;padding:15px;border-radius:5px}table{width:100%;border-collapse:collapse;margin-top:20px}th,td{border:1px solid #e5e7eb;padding:8px;text-align:left}th{background-color:#f9fafb}.total{font-weight:bold;text-align:right}</style></head><body><h1>Invoice #12345</h1><div class="invoice-details"><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Quantity</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td>Service B</td><td>1</td><td>$75.00</td><td>$75.00</td></tr><tr><td colspan="3" class="total">Total:</td><td>$125.00</td></tr></table><p>Thank you for your business!</p></div></body></html>'
}
},
responseType: 'arraybuffer'
};
axios.request(options)
.then(function (response) {
require('fs').writeFileSync('invoice.pdf', response.data);
console.log('PDF file saved successfully!');
})
.catch(function (error) {
console.error('Error generating PDF:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
url := "https://pdf-converter.example.com/pdf"
// HTML template for invoice (minified to one line)
htmlTemplate := `<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;color:#333}h1{color:#2563eb}table{width:100%;border-collapse:collapse}th,td{border:1px solid #e5e7eb;padding:8px}th{background:#f9fafb}.total{text-align:right;font-weight:bold}</style></head><body><h1>Invoice #12345</h1><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Quantity</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td>Service B</td><td>1</td><td>$75.00</td><td>$75.00</td></tr><tr><td colspan="3" class="total">Total:</td><td>$125.00</td></tr></table><p>Thank you for your business!</p></body></html>`
// Create request payload
requestBody := map[string]interface{}{
"pdf": map[string]interface{}{
"format": "A4",
"margin": map[string]string{
"top": "1cm",
"right": "1cm",
"bottom": "1cm",
"left": "1cm",
},
"printBackground": true,
},
"source": map[string]interface{}{
"html": htmlTemplate,
},
}
// Marshal request body to JSON
jsonData, err := json.Marshal(requestBody)
if err != nil {
fmt.Printf("Error marshalling JSON: %v", err)
return
}
// Create HTTP request
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
fmt.Printf("Error creating request: %v", err)
return
}
// Add headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "YOUR_API_KEY")
// Send request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Error sending request: %v", err)
return
}
defer resp.Body.Close()
// Check response status
if resp.StatusCode != http.StatusOK {
bodyBytes, _ := ioutil.ReadAll(resp.Body)
fmt.Printf("Error: %d, %s\n", resp.StatusCode, string(bodyBytes))
return
}
// Read response body
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("Error reading response: %v", err)
return
}
// Write PDF to file
err = os.WriteFile("invoice.pdf", bodyBytes, 0644)
if err != nil {
fmt.Printf("Error writing file: %v", err)
return
}
fmt.Println("PDF invoice generated successfully!")
}
<?php
// Set API endpoint and parameters
$url = 'https://pdf-converter.example.com/pdf';
$apiKey = 'YOUR_API_KEY';
// HTML template for invoice (minified to one line)
$htmlTemplate = '<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;color:#333}h1{color:#2563eb}table{width:100%;border-collapse:collapse}th,td{border:1px solid #e5e7eb;padding:8px}th{background:#f9fafb}.total{font-weight:bold;text-align:right}</style></head><body><h1>Invoice #12345</h1><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Quantity</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td>Service B</td><td>1</td><td>$75.00</td><td>$75.00</td></tr><tr><td colspan="3" class="total">Total:</td><td>$125.00</td></tr></table><p>Thank you for your business!</p></body></html>';
// Create request payload
$data = [
'pdf' => [
'format' => 'A4',
'margin' => [
'top' => '1cm',
'right' => '1cm',
'bottom' => '1cm',
'left' => '1cm'
],
'printBackground' => true
],
'source' => [
'html' => $htmlTemplate
]
];
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'x-api-key: ' . $apiKey
]);
// Execute cURL request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Check for errors
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else if ($httpCode != 200) {
echo 'Error: HTTP code ' . $httpCode;
} else {
// Save PDF file
file_put_contents('invoice.pdf', $response);
echo 'PDF invoice generated successfully!';
}
// Close cURL session
curl_close($ch);
?>
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class PdfConverter {
public static void main(String[] args) {
try {
// API endpoint
String apiUrl = "https://pdf-converter.example.com/pdf";
String apiKey = "YOUR_API_KEY";
// HTML template for invoice (minified to one line)
String htmlTemplate = "<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;color:#333}h1{color:#2563eb}table{width:100%;border-collapse:collapse}th,td{border:1px solid #e5e7eb;padding:8px}th{background:#f9fafb}.total{font-weight:bold;text-align:right}</style></head><body><h1>Invoice #12345</h1><p><strong>Date:</strong> April 13, 2025</p><p><strong>Customer:</strong> Acme Inc.</p><table><tr><th>Item</th><th>Quantity</th><th>Price</th><th>Total</th></tr><tr><td>Product A</td><td>2</td><td>$25.00</td><td>$50.00</td></tr><tr><td>Service B</td><td>1</td><td>$75.00</td><td>$75.00</td></tr><tr><td colspan=\"3\" class=\"total\">Total:</td><td>$125.00</td></tr></table><p>Thank you for your business!</p></body></html>";
// Create JSON payload
String jsonPayload = String.format("""
{
"pdf": {
"format": "A4",
"margin": {
"top": "1cm",
"right": "1cm",
"bottom": "1cm",
"left": "1cm"
},
"printBackground": true
},
"source": {
"html": "%s"
}
}
""", htmlTemplate);
// Create HTTP client
HttpClient client = HttpClient.newHttpClient();
// Build the request
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(apiUrl))
.header("Content-Type", "application/json")
.header("x-api-key", apiKey)
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
// Send request and get response
HttpResponse response = client.send(
request,
HttpResponse.BodyHandlers.ofByteArray()
);
// Check response status
if (response.statusCode() != 200) {
System.out.println("Error: " + response.statusCode() + ", " + new String(response.body()));
return;
}
// Save PDF file
Path outputPath = Paths.get("invoice.pdf");
Files.write(outputPath, response.body());
System.out.println("PDF invoice generated successfully!");
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}
}
Sign up today and get your first 200 requests for free
Create AccountNo credit card required