Skip to main content
POST
/
v1
/
pdf
Create PDF
curl --request POST \
  --url https://api.pdfecho.com/v1/pdf \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "<string>",
  "compliance": {
    "gdpr": false,
    "hipaa": false
  },
  "disable_javascript": false,
  "filename": "<string>",
  "format": "a4",
  "margin": {
    "top": "<string>",
    "right": "<string>",
    "bottom": "<string>",
    "left": "<string>"
  },
  "pages": "<string>",
  "storage": {
    "provider": "pdfecho",
    "filename": "<string>"
  },
  "webhook": "<string>",
  "zoom": 123
}
'

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Headers

pe-test-mode
boolean
default:false

When set to true, the request will not consume any credits/coins from the account, but the generated PDF will include a watermark. When set to false or omitted, credits will be consumed and no watermark will be applied.

Body

application/json
source
string
required

The HTML source to convert to PDF. Can be a raw HTML string or a URL.

compliance
object

Compliance flags for special data handling

disable_javascript
boolean
default:false

If true, JavaScript execution is disabled during PDF rendering. Useful for static rendering or when security concerns require blocking scripts.

filename
string

Output filename. Must only contain letters, numbers, underscores, hyphens, or dots, and must end with .pdf.

format
string
default:a4

Page format. Accepted values: letter, legal, tabloid, ledger, a0-a6, or custom size in the format {width}x{height} (e.g., 800pxx600px, 21cmx29.7cm).

margin
object

Page margins. Each property accepts a string with a unit (px, cm, mm, in).

pages
string

Page range to include in the output PDF (e.g., "1-3", "2,4,6").

storage
PDF Echo · object
webhook
string

If provided, a POST request will be sent to this URL when PDF generation is complete.

zoom
integer

Scaling factor for the rendering engine. Values greater than 1 zoom in; less than 1 zoom out.