PDF API
LoginPDF API Usage Guide
Welcome to the PDF API! This page explains how to use the API to convert, upload, and manage PDF files. All endpoints are RESTful and return JSON responses.
Authentication
- Sign up for an account to receive your API key.
- Include your API key in the Authorization header for all requests.
Endpoints
1. Convert HTML to PDF
POST https://converter.flexcoder.nl/api/conversions
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
{
"html": "<h1>Hello PDF!</h1>"
}
Send a JSON POST request with an html key containing your HTML string.
The response will be JSON:
{
"file": "https://converter.flexcoder.nl/path/to/file.pdf",
"byte_size": 123456
}
The file is a URL to the generated PDF, and byte_size is the file size in bytes.
Page properties
You can customize the PDF output using optional parameters in your request:
{
"html": "<h1>Hello PDF!</h1>",
"margin_top": "0.4",
"margin_bottom": "0.4",
"margin_left": "0.4",
"margin_right": "0.4",
"paper_width": "8.5",
"paper_height": "11",
"scale": "1.0",
"orientation": "portrait",
"single_page": "false",
"print_background": "true",
"omit_background": "false"
}
Available parameters:
- margin_top - Top margin in inches (e.g., "0.4")
- margin_bottom - Bottom margin in inches
- margin_left - Left margin in inches
- margin_right - Right margin in inches
- paper_width - Paper width in inches (e.g., "8.5" for Letter)
- paper_height - Paper height in inches (e.g., "11" for Letter)
- scale - Scale factor (e.g., "1.0" for 100%)
- orientation - "portrait" or "landscape"
- single_page - "true" or "false" - force single page output
- print_background - "true" or "false" - include background graphics
- omit_background - "true" or "false" - omit default white background
Example: cURL Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Hello PDF!</h1>"}' \
https://converter.flexcoder.nl/api/conversions
Support
For help, contact support@flexcoder.nl.