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.
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.
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.
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());
}
}