Documentation
Everything you need to convert URLs into branded PDFs.
Introduction
The PDF API accepts a URL and returns a PDF. It supports WordPress Application Password authentication, Divi builder rendering, custom branded headers/footers, and per-tenant branding defaults.
Base URL: https://pdftool.kkiani.com
Authentication
All API requests require an API key sent in the x-api-key header. Get your key from the portal after signing up.
Quickstart
Generate your first PDF in one request:
Generate PDF
/api/v1/generate-pdf
Converts a URL to a PDF. Returns the PDF binary with Content-Type: application/pdf.
Request body
| Field | Type | Description |
|---|---|---|
| url | string | Required. URL of the page to convert. |
| wpAuth | object | Optional. WordPress credentials for protected pages. |
| options | object | Optional. See sections below. |
options (PDF settings)
| Field | Type | Description |
|---|---|---|
| format | string | A4, A3, A5, Letter, Legal, Tabloid, Ledger. Default: A4. |
| landscape | boolean | Landscape orientation. Default: false. |
| printBackground | boolean | Render background colors/images. Default: true. |
| scale | number | Render scale (0.1 – 2). Default: 1. |
| margin | object | {top, right, bottom, left} in cm/mm/px. Default: 1cm. |
| viewport | object | {width, height}. Default: 1920×1080. |
| waitUntil | string | networkidle, load, domcontentloaded. Default: domcontentloaded. |
| navigationTimeout | number | ms. Default: 45000. |
| customCSS | string | Custom CSS injected into the page before rendering. |
| hideElements | string[] | CSS selectors to hide. |
options.diviOptions
Divi builder support — template unwrapping, column layout, lazy image loading.
| Field | Type | Description |
|---|---|---|
| enabled | boolean | Enable Divi processing. Default: false. |
| waitForSections | boolean | Wait for .et_pb_section to render. Default: true. |
| disableAnimations | boolean | Neutralize Divi animations. Default: true. |
| handleLazyImages | boolean | Scroll to trigger lazy-loaded images. Default: true. |
Tip: Add CSS class hideprint or noprint to any WP element to exclude it from the PDF.
options.pdfHeader
Branded header and footer on every page.
| Field | Type | Description |
|---|---|---|
| title | string | Required. Document title shown in header. |
| subtitle | string | Shown in footer left. |
| logoUrl | string | Logo image URL (fetched and embedded). |
| confidential | boolean | Show red CONFIDENTIAL badge. Default: false. |
| showRef | boolean | Show document reference code. Default: true. |
wpAuth
Authenticate into protected WordPress pages using Application Passwords. Requires the PDF API WordPress plugin installed on the target site.
| Field | Type | Description |
|---|---|---|
| username | string | WordPress username. |
| applicationPassword | string | App password from WP profile. |
Full example
Stats
/api/v1/stats
Returns usage stats scoped to your tenant (total PDFs, success rate, daily counts, top URLs, recent jobs).
WordPress Plugin
The PDF API WordPress plugin provides a secure proxy so API credentials never reach the browser. It also adds a Download PDF button to any page via shortcode or auto-inject.
Features
- Admin settings page — configure API URL, key, WP credentials, branding
- Shortcode — [pdf_download] places a branded button anywhere
- Auto-inject — add button to all descendants of a parent page
- Session cookie endpoint — lets the API access protected pages
- Print exclusion — .hideprint CSS class removes elements from PDF
Shortcode examples
Orientation defaults to portrait — best for content-heavy multi-section pages. Use landscape="true" on single-product spotlight pages where one large hero image sits beside text.
Error codes
| Code | Meaning | Description |
|---|---|---|
| 400 | Bad Request | Invalid request body or parameters. |
| 401 | Unauthorized | Missing API key or WP auth failed. |
| 403 | Forbidden | Invalid API key. |
| 408 | Request Timeout | Page load timeout exceeded. |
| 422 | Navigation Failed | URL unreachable or failed to load. |
| 429 | Too Many Requests | Rate limit or monthly quota exceeded. |
| 500 | Server Error | Unexpected error. |
| 502 | Bad Gateway | Could not reach WordPress. |
Ready to start?
Create your free account →