HTML to PDF Converter

Convert HTML content to PDF files using our online converter

API Usage

Use this API endpoint to convert HTML to PDF programmatically:

Endpoint:

POST /api/v2

Using Vercel-optimized endpoint for production deployment

cURL Examples:

HTML Content:

curl -X POST http://localhost:3000/api/v2 \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello World</h1>"}' \
  --output output.pdf

Website URL:

curl -X POST http://localhost:3000/api/v2 \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}' \
  --output webpage.pdf

Request Body Options:

// For HTML content:
{
  "html": "<h1>Your HTML content</h1>",
  "options": {
    "format": "A4",
    "printBackground": true,
    "marginTop": "1cm",
    "marginRight": "1cm", 
    "marginBottom": "1cm",
    "marginLeft": "1cm",
    "landscape": false
  }
}

// For website URL:
{
  "url": "https://example.com",
  "options": {
    "format": "A4",
    "printBackground": true,
    "marginTop": "1cm",
    "marginRight": "1cm", 
    "marginBottom": "1cm",
    "marginLeft": "1cm",
    "landscape": false
  }
}