Options Reference
Complete reference for all configuration options across PDFGen Studio API endpoints.
Common Options
These options are available across multiple endpoints:
| Option | Type | Default | Description |
|---|---|---|---|
format | string | pdf | Output format: pdf, png, jpg |
response | string | binary | Response type: binary, base64 |
quality | number | varies | Image quality (see endpoint specifics) |
timeout | number | 30000 | Render timeout in milliseconds |
Options by Endpoint
Template Renderer Options
format, response, textOverflow, tablePagination, tableHeaderOnNewPage, pixelRatio, quality, pageIndex
| Option | Type | Default | Values |
|---|---|---|---|
format | string | pdf | pdf, png, jpg |
response | string | binary | binary, base64 |
textOverflow | string | truncate | truncate, wrap, scale, none |
tablePagination | boolean | true | true, false |
tableHeaderOnNewPage | boolean | true | true, false |
pixelRatio | number | 2 | 1 - 4 |
quality | number | 0.95 | 0.1 - 1 |
pageIndex | number | - | 0 - n |
JSON Renderer Options
format, response, validate, scale, quality, printBackground, displayHeaderFooter,
headerTemplate, footerTemplate, timeout, fullPage, omitBackground, raw
| Option | Type | Default | Values |
|---|---|---|---|
format | string | pdf | pdf, png, jpg, html |
response | string | binary | binary, base64, preview |
validate | boolean | false | true, false |
scale | number | 1 | 0.1 - 2 |
quality | number | 90 | 1 - 100 |
printBackground | boolean | true | true, false |
displayHeaderFooter | boolean | false | true, false |
headerTemplate | string | - | HTML string |
footerTemplate | string | - | HTML string |
timeout | number | 30000 | 1000 - 120000 |
fullPage | boolean | false | true, false |
omitBackground | boolean | false | true, false |
raw | boolean | false | true, false |
HTML Renderer Options
format, response, pageFormat, orientation, margins, scale, printBackground,
displayHeaderFooter, headerTemplate, footerTemplate, timeout, width, height,
pageRanges, imageType, quality, fullPage, omitBackground
| Option | Type | Default | Values |
|---|---|---|---|
format (query) | string | pdf | pdf, png, jpg |
pageFormat / format (body) | string | A4 | A4, A3, A5, Letter, Legal, Tabloid |
orientation | string | portrait | portrait, landscape |
margins | string/object | - | CSS margin values |
scale | number | 1 | 0.1 - 2 |
printBackground | boolean | true | true, false |
displayHeaderFooter | boolean | false | true, false |
timeout | number | 30000 | 1000 - 120000 |
width | string | - | CSS dimension |
height | string | - | CSS dimension |
pageRanges | string | - | e.g., "1-5, 8" |
imageType | string | png | png, jpeg, jpg |
quality | number | 90 | 1 - 100 |
fullPage | boolean | true | true, false |
omitBackground | boolean | false | true, false |
URL Renderer Options
format, response, pageSize, orientation, margins, scale, printBackground, timeout,
viewportWidth, viewportHeight, waitUntil, waitForSelector, delay, fullPage,
quality, omitBackground, clip, headers, httpAuth
| Option | Type | Default | Values |
|---|---|---|---|
format | string | pdf | pdf, png, jpg |
response | string | binary | binary, base64 |
pageSize | string | A4 | A4, A3, A5, Letter, Legal, Tabloid |
orientation | string | portrait | portrait, landscape |
viewportWidth | number | 1280 | pixels |
viewportHeight | number | 720 | pixels |
waitUntil | string | load | load, domcontentloaded, networkidle |
waitForSelector | string | - | CSS selector |
waitForSelectorTimeout | number | 10000 | milliseconds |
delay | number | 0 | 0 - 30000 |
timeout | number | 30000 | 1000 - 120000 |
fullPage | boolean | true | true, false |
quality | number | 90 | 1 - 100 |
omitBackground | boolean | false | true, false |
clip | object | - | { x, y, width, height } |
headers | object | - | Custom HTTP headers (body only) |
httpAuth | object | - | { username, password } (body only) |
Query Params vs Body Options
All endpoints support options in both query params and request body:
Query Parameters
Best for:
- Quick, one-off requests
- Dynamic URL construction
- Testing via browser or curl
POST /api/v1/renderer/html?format=pdf&pageFormat=A4&orientation=landscape
Body Options
Best for:
- Complex configuration
- Sensitive data (headers, auth)
- Programmatic usage
{
"html": "<h1>Hello</h1>",
"options": {
"format": "A4",
"orientation": "landscape",
"margins": { "top": "20mm" }
}
}
Precedence Rule
Query parameters always take precedence over body options.
POST /api/v1/renderer/json?format=png
Body: { "document": {...}, "options": { "format": "pdf" } }
# Result: format=png (query wins)
Header/Footer Template Variables
When using displayHeaderFooter: true, you can use these CSS classes in your templates:
| Class | Description |
|---|---|
.date | Current date |
.title | Document title |
.url | Document URL |
.pageNumber | Current page number |
.totalPages | Total page count |
Example:
<div style="font-size: 10px; width: 100%; text-align: center;">
Page <span class="pageNumber"></span> of <span class="totalPages"></span>
</div>
Margin Formats
Margins can be specified in multiple formats:
Single Value
"margins": "20mm"
Two Values (vertical, horizontal)
"margins": "10mm 20mm"
Four Values (top, right, bottom, left)
"margins": "10mm 20mm 10mm 20mm"
Object
"margins": {
"top": "10mm",
"right": "20mm",
"bottom": "10mm",
"left": "20mm"
}
Supported Units
| Unit | Description |
|---|---|
px | Pixels |
mm | Millimeters |
cm | Centimeters |
in | Inches |
pt | Points |