---
title: "Generate PDF"
method: POST
path: "/v1/pdf"
tags: ["PDF"]
---

# Generate PDF

`POST /v1/pdf`

Generate a PDF from any URL or HTML. Supports page sizes, margins, headers/footers, and scaling.

## Request body

- ScreenshotRequest
  - `url` string, uri
  - `html` string — Raw HTML to render
  - `markdown` string — Markdown to render
  - `format` 'png' | 'jpeg' | 'webp' | 'avif' | 'pdf'
  - `quality` integer
  - `device` 'desktop-1080p' | 'desktop-1440p' | 'desktop-4k' | 'macbook-pro-13' | 'macbook-pro-16' | 'imac-24' | 'iphone-12' | 'iphone-13' | 'iphone-14' | 'iphone-14-pro' | 'iphone-15' | 'iphone-15-pro' | 'iphone-15-pro-max' | 'iphone-se' | 'ipad' | 'ipad-mini' | 'ipad-air' | 'ipad-pro-11' | 'ipad-pro-12.9' | 'pixel-7' | 'pixel-8' | 'pixel-8-pro' | 'samsung-galaxy-s23' | 'samsung-galaxy-s24' | 'samsung-galaxy-tab-s9'
  - `width` integer
  - `height` integer
  - `deviceScaleFactor` number
  - `isMobile` boolean
  - `hasTouch` boolean
  - `isLandscape` boolean
  - `fullPage` boolean
  - `fullPageScrollDelay` integer
  - `fullPageMaxHeight` integer
  - `selector` string — CSS selector to capture specific element
  - `clipX` integer
  - `clipY` integer
  - `clipWidth` integer
  - `clipHeight` integer
  - `delay` integer
  - `timeout` integer
  - `waitUntil` 'load' | 'domcontentloaded' | 'networkidle'
  - `waitForSelector` string
  - `darkMode` boolean
  - `reducedMotion` boolean
  - `css` string — Custom CSS (Starter+)
  - `javascript` string — Custom JS (Pro+)
  - `hideSelectors` string[]
  - `clickSelector` string
  - `clickDelay` integer
  - `blockAds` boolean — Block ads (Starter+)
  - `blockTrackers` boolean — Block trackers (Pro+)
  - `blockCookieBanners` boolean
  - `blockChatWidgets` boolean
  - `blockResources` string[]
  - `userAgent` string
  - `extraHeaders` object
  - `cookies` object[]
    - `name` string
    - `value` string
    - `domain` string
    - `path` string
  - `httpAuth` object
    - `username` string
    - `password` string
  - `proxy` object
    - `server` string, uri
    - `username` string
    - `password` string
  - `geolocation` object
    - `latitude` number
    - `longitude` number
    - `accuracy` number
  - `timezone` string
  - `locale` string
  - `pdfOptions` object
    - `pageSize` 'a4' | 'a3' | 'a5' | 'letter' | 'legal' | 'tabloid' | 'custom'
    - `landscape` boolean
    - `printBackground` boolean
    - `scale` number
    - `marginTop` string
    - `marginBottom` string
    - `marginLeft` string
    - `marginRight` string
    - `headerTemplate` string
    - `footerTemplate` string
    - `displayHeaderFooter` boolean
    - `pageRanges` string
  - `thumbnail` object
    - `enabled` boolean
    - `width` integer
    - `height` integer
    - `fit` 'cover' | 'contain' | 'fill'
  - `failOnHttpError` boolean
  - `failIfContentMissing` string[]
  - `failIfContentContains` string[]
  - `cache` boolean — Enable caching (Pro+)
  - `cacheTtl` integer
  - `responseType` 'binary' | 'base64' | 'json'
  - `includeMetadata` boolean
  - `extractMetadata` object
    - `fonts` boolean
    - `colors` boolean
    - `links` boolean
    - `httpStatusCode` boolean
  - `storage` object
    - `enabled` boolean
    - `destination` 'snapapi' | 'user_s3'
  - `async` boolean
  - `webhookUrl` string, uri
  - `webhookHeaders` object

## Response `200`

PDF generated

## Other responses

- `400` — Validation error
- `401` — Invalid API key

---

[API](https://skmtc.net/snapapi/apis/snapapi-screenshot-web-data-api.md) · [All operations](https://skmtc.net/snapapi/apis/snapapi-screenshot-web-data-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/snapapi/snapapi-screenshot-web-data-api/versions/b12ff2791613/schema)
