canonical: https://jentic.com/apis/pdfbroker.io/pdfbroker

# PdfBroker.io API

PdfBroker.io API generates PDF documents from HTML (via wkhtmltopdf and WeasyPrint engines), XSL-FO templates with optional XSLT transforms, and provides utilities for concatenating multiple PDFs, converting PDFs to images, and writing text strings onto existing PDF pages. The API uses OAuth 2.0 client credentials authentication and returns generated files as downloadable binary responses.

## For AI agents

Generate PDF documents from HTML templates or XSL-FO, concatenate multiple PDFs, convert pages to images, and overlay text onto existing PDF files.

## Scope

Does not handle PDF parsing, OCR, data extraction, or form filling - use for PDF generation from templates and basic utility operations only.

## Capabilities

- Generate PDF documents from HTML using wkhtmltopdf rendering engine
- Generate PDF documents from HTML using WeasyPrint rendering engine
- Render XSL-FO templates into PDF with full formatting support
- Apply XSLT transformations before XSL-FO rendering for dynamic content
- Concatenate multiple PDF files into a single document
- Convert PDF pages to image format for preview and thumbnail generation
- Write text strings at specified coordinates onto existing PDF pages

## Use cases

### HTML to PDF Report Generation

Generate professional PDF documents from HTML templates with CSS styling. PdfBroker offers two rendering engines: wkhtmltopdf (POST /api/pdf/wkhtmltopdf) for webkit-based rendering with JavaScript support, and WeasyPrint (POST /api/pdf/weasyprint) for CSS3-compliant rendering with better print media support. Both accept HTML content and return the generated PDF as a binary download, enabling automated report, invoice, and certificate generation.

Example prompt: Generate a PDF invoice from HTML content via POST /api/pdf/wkhtmltopdf with the HTML body containing styled invoice data and return the PDF binary

### XSL-FO Template Rendering

Render complex documents from XSL-FO templates for enterprise document generation workflows. POST /api/pdf/xslfo accepts XSL-FO markup and produces formatted PDF output. POST /api/pdf/xslfowithtransform first applies an XSLT stylesheet to transform XML data into XSL-FO, then renders the result. This enables data-driven document generation from XML sources with full typographic control.

Example prompt: Submit an XSL-FO template via POST /api/pdf/xslfo and return the rendered PDF document for a structured report layout

### PDF Assembly and Modification

Combine multiple PDF files and overlay text content for document preparation workflows. POST /api/pdf/pdfconcat merges multiple PDFs in order. POST /api/pdf/pdfwritestring places text at specific X/Y coordinates on existing pages for stamping dates, reference numbers, or approval text. POST /api/pdf/pdftoimage converts pages to images for preview generation.

Example prompt: Concatenate a cover page PDF and a report body PDF via POST /api/pdf/pdfconcat, then write 'APPROVED' at coordinates (400, 50) on page 1 via POST /api/pdf/pdfwritestring

### AI Agent Document Generation via Jentic

AI agents use the PdfBroker API through Jentic to generate PDF documents from HTML or XSL-FO templates without managing OAuth token flows. Agents search by intent, receive typed schemas for generation operations, and execute with Jentic handling the client_credentials token exchange and injection. This enables automated document generation for invoices, reports, and certificates.

Example prompt: Search Jentic for 'generate PDF from HTML', load the schema for POST /api/pdf/wkhtmltopdf, and execute with HTML content to produce a downloadable PDF

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /api/pdf/wkhtmltopdf | Generate PDF from HTML using wkhtmltopdf |
| POST | /api/pdf/weasyprint | Generate PDF from HTML using WeasyPrint |
| POST | /api/pdf/xslfo | Render PDF from XSL-FO template |
| POST | /api/pdf/xslfowithtransform | Apply XSLT then render XSL-FO to PDF |
| POST | /api/pdf/pdfconcat | Concatenate multiple PDF files |
| POST | /api/pdf/pdftoimage | Convert PDF pages to images |
| POST | /api/pdf/pdfwritestring | Write text at coordinates on a PDF |
| GET | /api/pdf | Get API info and available options |

## Key resources

- **PDF Generation** — Create PDFs from HTML (wkhtmltopdf and WeasyPrint) and XSL-FO templates
- **PDF Utilities** — Concatenate, convert to image, and write text on existing PDFs
- **API Info** — Retrieve available API options and service status

## Why Jentic

- **Setup:** Wiring the PdfBroker.io API by hand means running the OAuth 2.0 client_credentials exchange at login.pdfbroker.io/connect/token, refreshing the token, and choosing between the wkhtmltopdf, weasyprint, and XSL-FO renderers yourself. Through Jentic you install once, import PdfBroker.io from the API Directory, store the client credentials once, and your agent calls it.
- **Permission scoping:** PdfBroker.io carries its content and rendering options in the request body, so scope the agent by the operations it needs, such as generating a PDF with wkhtmltopdf or converting a PDF to an image. You choose that set, so operations like concatenation or string writing are not included unless you add them.
- **Credential handling:** Your PdfBroker.io OAuth client credentials are stored once, encrypted, by your own Jentic One instance, which runs the token exchange and injects the bearer token at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'generate a PDF from an HTML template', and Jentic returns the matching PdfBroker.io operation with its input schema specifying content format and rendering options so the agent calls the right endpoint without reading the reference docs.

## Related APIs

- **PDF Blocks API** — PDF manipulation (merge, password, watermark) that pairs with PdfBroker generation
- **HTML2PDF API** — Simpler HTML-to-PDF conversion without XSL-FO or multi-engine support
- **CraftMyPDF API** — Template-based PDF generation with visual editor and JSON data merge

## FAQ

### What authentication does the PdfBroker.io API use?

The PdfBroker.io API uses OAuth 2.0 with the client_credentials grant type. You exchange your client ID and secret for an access token at https://login.pdfbroker.io/connect/token with scope 'pdfbroker', then include the token in the Authorization header. Through Jentic, this token flow is handled automatically.

### What is the difference between wkhtmltopdf and WeasyPrint engines?

POST /api/pdf/wkhtmltopdf uses a WebKit-based renderer that supports JavaScript execution and browser-like rendering. POST /api/pdf/weasyprint uses a CSS3-compliant renderer optimized for print media queries and paged media standards. Choose wkhtmltopdf for dynamic content and WeasyPrint for precise print layouts.

### What are the rate limits for the PdfBroker.io API?

PdfBroker.io applies per-token rate limits based on your subscription plan. Standard plans support up to 50 PDF generations per minute. XSL-FO rendering with XSLT transforms may take longer per request due to processing complexity.

### How do I generate a PDF from HTML through Jentic?

Search Jentic for 'create PDF from HTML template', load the schema for POST /api/pdf/wkhtmltopdf, and execute with your HTML content in the request body. Jentic handles the OAuth token exchange and returns the generated PDF binary for download or storage.

### Can I add text to an existing PDF?

Yes. POST /api/pdf/pdfwritestring accepts an existing PDF and writes text at specified X/Y coordinates on a given page. This is useful for adding stamps, dates, reference numbers, or approval text without regenerating the entire document.

### Can I limit what my agent is allowed to do with the PdfBroker.io API?

Yes. Because you run Jentic One yourself, your own rules decide which PdfBroker.io operations the agent can call, so you can allow just HTML-to-PDF generation with wkhtmltopdf or WeasyPrint and rendering PDF pages to images. Operations like concatenating PDFs or writing text strings onto existing pages stay out of reach unless you add them to the agent's allowed set. Your OAuth client credentials are held by your Jentic One instance and injected at call time, so the agent only ever exercises the operations you permit.
