> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pictify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF Generation API

> Generate single and multi-page PDFs from HTML templates — invoices, certificates, and reports with variables per render

# PDF Generation

Generate PDFs from templates with support for multiple pages, standard paper sizes, and custom dimensions.

## Endpoints

| Method | Endpoint | Description |
| - | - | - |
| `POST` | `/pdf/render` | [Render PDF](/api-reference/endpoints/pdfs/render) from a template |
| `POST` | `/pdf/multi-page` | [Multi-page PDF](/api-reference/endpoints/pdfs/multi-page) with different content per page |
| `GET` | `/pdf/presets` | [List presets](/api-reference/endpoints/pdfs/presets) for paper sizes |

## Paper Size Presets

| Preset | Dimensions | Description |
| - | - | - |
| `A4` | 210 x 297 mm | ISO standard, most common worldwide |
| `Letter` | 8.5 x 11 in | US standard letter size |
| `Legal` | 8.5 x 14 in | US legal size |
| `A3` | 297 x 420 mm | Large format |
| `A5` | 148 x 210 mm | Compact size, booklets |
| `custom` | User-defined | Specify with `customSize` |

## Key Options

| Parameter | Type | Default | Description |
| - | - | - | - |
| `preset` | string | `A4` | Paper size preset |
| `landscape` | boolean | `false` | Landscape orientation |
| `margins` | object | - | Page margins (`top`, `bottom`, `left`, `right`) in pixels |
| `customSize` | object | - | Custom dimensions when preset is `custom` |
| `printBackground` | boolean | `true` | Include CSS backgrounds |
| `scale` | number | `1` | Scale factor (0.1-2.0) |

<Note>
  The `userStorageUrl` response field is only included if you have configured custom storage.
</Note>

## Best Practices

1. **Design for print** -- use CMYK-friendly colors and sufficient margins
2. **Test at scale** -- preview PDFs at 100% zoom before production
3. **Optimize images** -- use appropriate resolution (150-300 DPI for print)
4. **Consider page breaks** -- design templates with natural page breaks for multi-page docs
5. **Use web-safe fonts** -- or embed custom fonts in your template


## OpenAPI

````yaml post /pdf/render
openapi: 3.1.0
info:
  title: Pictify API
  version: 1.0.0
  description: |
    Generate images, GIFs, and PDFs from HTML templates programmatically.

    ## Authentication
    All API requests require a Bearer token in the Authorization header:
    ```
    Authorization: Bearer pk_live_your_api_key
    ```

    ## Rate Limits
    - Free: 60 requests/minute
    - Pro: 300 requests/minute
    - Business: 1,000 requests/minute

    Rate limit headers are included in all responses.
  contact:
    email: support@pictify.io
    url: https://pictify.io
  license:
    name: MIT
servers:
  - url: https://api.pictify.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: Image generation endpoints
  - name: GIFs
    description: GIF generation and capture
  - name: PDFs
    description: PDF generation
  - name: Templates
    description: Template management
  - name: Batch
    description: Batch rendering operations
  - name: Webhooks
    description: Webhook subscription management
  - name: Bindings
    description: Data binding for auto-rendering
paths:
  /pdf/render:
    post:
      tags:
        - PDFs
      summary: Generate a PDF
      description: Generate a single-page PDF from a template
      operationId: renderPdf
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PdfRenderRequest'
      responses:
        '200':
          description: PDF generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PdfResponse'
components:
  schemas:
    PdfRenderRequest:
      type: object
      required:
        - templateUid
      properties:
        templateUid:
          type: string
          description: Template UID
        variables:
          type: object
          additionalProperties: true
        options:
          type: object
          properties:
            preset:
              type: string
              enum:
                - A4
                - Letter
                - Legal
                - A3
                - A5
                - A3_LANDSCAPE
                - CUSTOM
              default: A4
            customSize:
              type: object
              properties:
                width:
                  type: integer
                height:
                  type: integer
            margins:
              type: object
              properties:
                top:
                  type: integer
                bottom:
                  type: integer
                left:
                  type: integer
                right:
                  type: integer
            title:
              type: string
    PdfResponse:
      type: object
      properties:
        success:
          type: boolean
        url:
          type: string
          format: uri
        userStorageUrl:
          type: string
          format: uri
        pageCount:
          type: integer
        preset:
          type: string
        pageSize:
          type: object
          properties:
            width:
              type: integer
            height:
              type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key obtained from the Pictify dashboard

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.