Skip to main content

Setting up

Before you can use the API, you need to create an account and get an API key.

Create your account

It’s free, requires no credit card, and takes less than a minute.

Get your API key

Once you have an account, you can create an API key.

Rendering a simple PDF

The simplest way to generate a PDF is using the synchronous endpoint. This endpoint accepts your content and returns the generated PDF directly in the response.

Basic request structure

curl -X POST 'https://vortexpdf.com/api/v1/renderers/pdf' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "parts": ["<h1>Hello World</h1><p>This is my first PDF!</p>"]
  }' \
  --output hello-world.pdf

Rendering from a URL

You can also render a PDF from an existing webpage:
curl -X POST 'https://vortexpdf.com/api/v1/renderers/pdf' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "parts": ["https://example.com"]
  }' \
  --output example.pdf

Customizing your PDF

You can customize various aspects of your PDF using additional parameters:
curl -X POST 'https://vortexpdf.com/api/v1/renderers/pdf' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "parts": ["<h1>Custom PDF</h1><p>With custom settings</p>"],
    "size": "letter",
    "orientation": "landscape",
    "margin": {
      "top": 10,
      "right": 10,
      "bottom": 10,
      "left": 10,
      "unit": "mm"
    },
    "header_template": "<div style=\"text-align: center; width: 100%; font-size: 10px;\"><span class=\"date\"></span></div>",
    "footer_template": "<div style=\"text-align: center; width: 100%; font-size: 10px;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
    "render_header_footer": true
  }' \
  --output custom.pdf

Next steps

Now that you’ve created your first PDF, explore more advanced features:
  • Combine multiple HTML snippets or URLs into a single PDF
  • Add headers and footers with dynamic content
  • Customize page size, orientation, and margins
  • Use JavaScript evaluation to manipulate content before rendering
  • Try the asynchronous endpoint for faster processing