DocRaptor
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.

Test mode and quota
You can start building and testing your workflow without a DocRaptor account. Use the public test key YOUR_API_KEY_HERE in your connection — no sign-up required. Documents generated this way are always watermarked (a "TEST" stamp overlaid on every page) and, for Excel files, are limited to a small number of rows, but are otherwise fully functional for development purposes.
Once you are happy with your workflow and ready to go to production, create a DocRaptor account, replace the test key with your real API key, and switch Test mode to Off. From that point your documents will be clean and unbranded, and each run will consume your DocRaptor plan quota.
Setting Up the Connection
In Stack AI, navigate to the Connections page.
Click Add Connection and select DocRaptor.
Enter your API key:
To test without an account, use
YOUR_API_KEY_HEREFor production use, log in at docraptor.com/login and copy your API key from the dashboard
Click Save.

Available Actions
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 Stack AI 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:
Examples
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.

Last updated
Was this helpful?

