Create PDF From HTML API
Start building for free today – no credit card required.
Easily convert HTML content into professional, high-quality PDFs with our API. Simply provide your HTML, and our API generates a perfectly formatted PDF in seconds. Ideal for creating invoices, reports, or any custom documents programmatically.
Claude, ChatGPT, Cursor or your own agent can call
create-pdf-file directly.
Benefits of our PDF Creation API
Create tailored PDFs that meet your exact requirements with our versatile PDF API.
Define custom page sizes, adjust margins to fit your layout needs, and effortlessly
add headers and footers for a professional touch. Whether you’re generating invoices,
reports, or multi-page documents, our API offers full control over the structure and
appearance of your PDFs. Achieve consistent formatting and deliver polished documents
every time, all with an easy-to-use solution that integrates seamlessly into your workflows.
Read our API documentation to learn how to create PDFs.
Multi-language Code Example
curl -X POST https://apdf.io/api/pdf/file/create \
-H "Authorization: Bearer TOKEN" \
-d html="<html><body><h1>Hello World!</h1></body></html>"
const data = new FormData();
data.append('html', '<html><body><h1>Hello World!</h1></body></html>');
fetch('https://apdf.io/api/pdf/file/create', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/create', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'html' => '<html><body><h1>Hello World!</h1></body></html>'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/create',
{
'html' => '<html><body><h1>Hello World!</h1></body></html>'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/create',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'html': '<html><body><h1>Hello World!</h1></body></html>'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"html": "<html><body><h1>Hello World!</h1></body></html>"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/create")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("html", "<html><body><h1>Hello World!</h1></body></html>")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/create")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
No-Code PDF Creation
Integrate our PDF API with Zapier Webhooks to automate your PDF creation workflows effortlessly. Whether you're generating invoices, contracts, or reports, you can trigger PDF creation from hundreds of apps supported by Zapier. Automatically convert form submissions, database entries, or other data into professionally formatted PDFs, saving time and eliminating manual processes.
Create PDF tutorials
Build an Automated Invoice Generator using HTML & Python
The tutorial explains how to build a Python invoice generator by using Jinja2 to merge data into standard HTML/CSS templates. Instead of manually coding complex PDF layouts, the script sends the rendered HTML to the Apdf API, which instantly converts it into a professional, downloadable PDF.
Dynamic Certificate Generation for Online Courses (LMS)
Learn how to dynamically generate professional PDF certificates for online course platforms using PHP. Design certificates with HTML/CSS, use landscape orientation, and automatically generate them when students complete courses.
How to Generate PDFs from Claude
Describe the document, get the PDF: Claude drafts the HTML layout and renders it through the Apdf MCP tools — invoices, reports and one-pagers straight from the conversation, with page format, margins and headers steered in plain English. Revisions are just more chat.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP