# PDF Generator API

Convert any URL into PDFs with our PDF generation API. Perfect for generating invoices, reports, and archives with full control over layout, and styling.

99.9% Uptime  Headless Chrome  Anti-Bot Bypass

[Get API Key](https://auth.geekflare.com/register?service=geekflare_api)

## Response

```json
{
  "timestamp": 1769007913216,
  "apiStatus": "success",
  "apiCode": 200,
  "meta": {
    "url": "https://geekflare.com",
    "device": "desktop",
    "format": "a4",
    "orientation": "portrait",
    "scale": 1,
    "test": {
      "id": "ecae2a87-5d97-41ac-960f-ea29c4b29272"
    }
  },
  "data": "https://cdn.geekflare.com/tests/url2pdf/HhAEd7C86YxFixAb"
}
```

Trusted by 10,000+ developers

## Copy, paste, and ship

Python

NodeJS

Go

PHP

Java

Ruby

cURL

```python
import requests

url = "https://api.geekflare.com/url2pdf"
payload = {"url": "https://example.com", "format": "a4"}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
```

## Why Geekflare PDF API

### Layout & Formatting

Full control over page orientation and standard formats to fit your document needs.

### Styling

Adjust scaling and set custom margins to ensure your data fits perfectly on the page.

### Add Timestamp

Automatically overlay timestamps on your documents. Essential for archives and compliance.

### Rotating Proxies

We rotate residential proxies for you to generate PDFs from worldwide location without getting blocked.

### Headless Browser

We render JavaScript just like a real user so the PDF looks exactly the same as the webpage.

### Global Network

Requests are routed through our global edge network to ensure low latency.

## PDF Generation API pricing

| Plan      | Price     | Credits         | Pages Generated     | Requests per Second |
|-----------|-----------|------------------|--------------------|---------------------|
| Free     | $0/mo     | 500 Credits/mo    | Generate ~100 pages | 1 Request           |
| Starter   | $9/mo     | 5K Credits/mo     | Generate ~1000 pages| 5 Requests          |
| Growth    | $49/mo    | 100K Credits/mo   | Generate ~20K pages | 25 Requests         |
| Business   | $249/mo   | 1M Credits/mo     | Generate ~200K pages| 50 Requests         |

## Other Geekflare API services

### Screenshot API

Capture high-quality PNG, JPG, or WebP screenshots of any website programmatically.

### Web Scraping API

Extract HTML, Markdown, or JSON from dynamic web pages with automatic CAPTCHA solving.

### Metadata Extraction API

Extract title, description, images, Schema.org, and Open Graph metadata from any URL.

### Site Load Time API

Check how much time your site takes to load including DNS, Connect, TLS, and TTFB metrics.

### Broken Link Checker API

Find dead internal and external links on a webpage.

## Frequently Asked Questions

### How long are the PDF URLs valid?

The generated PDF URLs are stored on our CDN for **30 days**. If you need longer retention, please contact us.

### How much does generating a PDF cost?

PDF generation consumes **5 credits** per request.

### Can I generate a PDF using a mobile device view?

Yes, by default, we use a desktop viewport, but you can instruct the API to emulate a mobile device. This allows you to capture the responsive mobile layout of the website in your PDF.

## Start with free plan - no credit card required.

Get your API key in less than 30 seconds. 500 free credits.

[Get Started Free](https://auth.geekflare.com/register?service=geekflare_api)
