xtract.bot

PDF page → PNG

Try it interactively →
POST /api/pdf-to-image

Rasterize a PDF page to PNG. Configurable DPI (72 / 150 / 300 / custom). Useful for thumbnails, preview generation, and feeding PDFs into image pipelines.

Renders one page of a PDF as a PNG bitmap. Options: - `page` (default 1): which page to render. - `dpi` (default 150): pixels-per-inch. `72` is screen, `150` is good general-purpose, `300` is print-quality. Higher DPI → larger image, more memory. Useful for thumbnail generation, preview rendering, or feeding PDFs into image pipelines that cannot read PDF directly.

Inputs

NameTypeDefaultDescription
pdf*filePDF document.
pagenumber11-based page index.
scalenumber (0.5…6)2Render scale. 1.0 = 72 DPI baseline; 2.0 = 144 DPI; capped at 6.

Response

Modes: binary, json. Cache: yes (24h TTL).

Code samples

Built from the hello-page-1 example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/pdf-to-image/hello.pdf
PDF=$(base64 -w0 < hello.pdf)

curl -X POST https://api.xtract.bot/api/pdf-to-image \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "page": 1,
  "scale": 2,
  "pdf": "'"$PDF"'"
}'