Connect DocRaptor and configure PDF output
DocRaptor is a document generation service that converts HTML or XML content into PDF or Excel files. Use it in your workflows to programmatically generate invoices, reports, contracts, or any formatted document — and get back a download link instantly.

Set up the connection
In StackAI, navigate to the Connections page.
Click Add Connection and select DocRaptor.
Sign in to DocRaptor, copy the API key from your dashboard, and enter it in the connection.
Select Save.

Configure document generation
Create Document
Converts HTML or XML content into a PDF or Excel file and returns a download URL.
Inputs:
Test mode
Select
Yes
On generates a free document (does not count against your key quota) with a "TEST" watermark on every page; Off generates a clean production document and uses your quota
Document content
Text
Yes
The HTML (for PDF) or XML (for Excel) content to convert
File type
Select
Yes
Output format: pdf, xls, or xlsx
File Name
Text
No
Optional name for the document, used in DocRaptor logs and as the filename
Outputs:
download_url
String
Pre-signed URL to download the generated file
expiration_date
DateTime
When the download URL expires
file_metadata.filename
String
Name of the generated file
file_metadata.mime_type
String
MIME type of the file
file_metadata.bytes
Integer
File size in bytes
file_metadata.created_at
DateTime
When the file was created

Structuring your HTML for PDF output
In a typical StackAI workflow, an LLM node generates the HTML that gets passed to DocRaptor. To get a well-structured PDF with headers, footers, and logos, include the formatting requirements directly in your prompt to the model. For example:
"Generate an HTML invoice for the following data. Include a
<header>with the company logo athttps://your-cdn.com/logo.pngand the invoice number, a<footer>with the company address, and a<table>with a<thead>for the line items. Use inline CSS withposition: running(header)andposition: running(footer)so they repeat on every page. All image URLs must be absolute."
DocRaptor uses the Prince XML engine to render HTML into PDF. It supports standard HTML and CSS, plus a few Prince-specific CSS properties that control page layout. The key concept is running elements — HTML elements that are pinned to the top or bottom margin of every page, which is how you get repeating headers and footers.
Page layout with @page
Use the CSS @page rule to define the paper size and margins. Set the top and bottom margins large enough to accommodate your header and footer, then place your running elements in those margin boxes:
Repeating header with logo
Mark any HTML element as a running header by setting position: running(header) in CSS. Everything inside it — logo, company name, invoice number — will repeat on every page:
Repeating footer
Same pattern for the footer:
Repeating table headers across pages
If your content includes a table that spans multiple pages, use <thead> — Prince will automatically repeat it at the top of each page:
Review the document layout
Connect an LLM node to generate HTML content, then pass the output into the DocRaptor Create Document node to produce a formatted PDF. The download_url output can be passed to a subsequent node to send the file via email or post it to Slack.

Connection fields and action reference
See DocRaptor for the current connector fields and supported actions.
Was this helpful?

