POST
/pdf
Generate PDF
Create a new PDF from HTML content or a URL.
Request Body
html
string
Optional
The raw HTML content to render. Required if url
is not provided.
url
string
Optional
The URL to render. Required if html is not
provided.
options
object
Configuration options for the PDF rendering.
format
string
Paper format. Options: A4,
Letter, A3. Default: A4.
landscape
boolean
Whether to print in landscape mode. Default:
false.
Example Request
Here's how to make a request in different languages:
curl -X POST https://feopdf.com/api/pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Invoice</h1><p>Total: $100</p>",
"options": {
"format": "Letter",
"landscape": false
}
}' \
--output invoice.pdf
const axios = require('axios');
const fs = require('fs');
const response = await axios.post(
'https://feopdf.com/api/pdf',
{
html: '<h1>Invoice</h1><p>Total: $100</p>',
options: {
format: 'Letter',
landscape: false
}
},
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
responseType: 'arraybuffer'
}
);
fs.writeFileSync('invoice.pdf', response.data);
import requests
response = requests.post(
'https://feopdf.com/api/pdf',
json={
'html': '<h1>Invoice</h1><p>Total: $100</p>',
'options': {
'format': 'Letter',
'landscape': False
}
},
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
)
with open('invoice.pdf', 'wb') as f:
f.write(response.content)
<?php
$ch = curl_init('https://feopdf.com/api/pdf');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'html' => '<h1>Invoice</h1><p>Total: $100</p>',
'options' => [
'format' => 'Letter',
'landscape' => false
]
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$pdf = curl_exec($ch);
file_put_contents('invoice.pdf', $pdf);
curl_close($ch);
Response
Returns the binary PDF content with Content-Type: application/pdf.