Skip to main content
Use POST /api/v1/generate with output_format: "pdf".

Important differences vs PNG

  • Response is binary application/pdf (not JSON).
  • PDF has a white background (no transparency).

Basic PDF example

curl -sS https://api.handtextai.com/api/v1/generate \
  -H "Authorization: Bearer htext_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from HandTextAI!",
    "font_id": 1,
    "font_size": "auto",
    "page_size": "letter",
    "dpi": 300,
    "output_format": "pdf",
    "pdf": { "preset": "generic" }
  }' \
  -o output.pdf

PDF options (pdf object)

These options are accepted only when output_format="pdf":
  • preset: generic (default), lob, click2mail
  • standard: pdf (default) or pdfx1a (CMYK PDF/X-1a:2001)
  • icc_profile: auto, gracol_2013, gracol_2006, pso_coated_v3, iso_coated_v2 (PDF/X-1a only)
  • profile: document, press, auto (standard PDF only)
  • region: auto, us, eu
  • bleed_mm: override bleed (mm)
  • crop_box: media, bleed, trim

Provider presets

Lob (strict preflight)

{
  "output_format": "pdf",
  "pdf": { "preset": "lob" }
}

Click2Mail (portal-friendly)

{
  "output_format": "pdf",
  "pdf": { "preset": "click2mail" }
}