Package Information
Available Nodes
Documentation generating…
Documentation
@castpdf/n8n-nodes-castpdf
This is an n8n community node. It lets you use CastPDF in your n8n workflows.
CastPDF turns HTML templates and your data into PDFs: invoices, receipts, certificates, reports and more. You design
a template once in CastPDF, then fill it with data from any workflow.
n8n is a fair-code licensed workflow automation
platform.
Installation
Operations
Credentials
Compatibility
Usage
Resources
Version history
Installation
Follow the installation guide in the n8n community
nodes documentation. The package name is @castpdf/n8n-nodes-castpdf.
Operations
CastPDF
| Resource | Operation | What it does |
|---|---|---|
| Create From Template | Fills one of your CastPDF templates with data and creates a PDF | |
| Create From HTML | Creates a PDF from HTML you write or map, without a saved template | |
| Template | Get | Gets a template with its HTML, CSS and sample data |
| Template | Get Many | Lists your templates, most recently changed first |
Both PDF operations return the PDF's details and a signed download URL. Turn on Download PDF File to also get
the PDF as binary data, ready for an email, Google Drive or S3 node.
The CastPDF node can be used as a tool by n8n's AI Agent.
CastPDF Trigger
Starts the workflow when a PDF is ready (pdf.created) or when a PDF failed (pdf.failed), for PDFs from any source:
the API, a batch, a spreadsheet run or another workflow. You can limit it to one template.
Credentials
You need a CastPDF account and an API key.
- Sign up at castpdf.com if you have no account yet.
- In CastPDF, open Connect > API and create an API key.
- In n8n, create a CastPDF API credential and paste the key into API Key. Leave Base URL as it is.
The key decides the mode:
- A live key (starts with
cpdf_live_) makes real PDFs that count toward your plan. - A test key (starts with
cpdf_test_) makes free PDFs with a "CASTPDF TEST" watermark.
n8n checks the key when you save the credential.
Compatibility
Built with @n8n/node-cli 0.51.4 against n8n-workflow 2.42 (n8n 2.x). The template fields use n8n's resource mapper
and the trigger uses webhooks, so use a current n8n version. The trigger needs an n8n instance that CastPDF can reach
over public https (see below).
Usage
Create a PDF from a template
- Pick the Template from the list (or paste its ID).
- Under Data, choose Template Fields and keep Map Each Field Manually. The template's fields appear,
read from the template's sample data: one field per value (likeCustomer > Name), and one list field per group of line items (likeItems (line items: description, quantity, price)). Map a list of objects to a line item field, for example{{ $json.line_items }}. - Numbers and true/false values are converted to the type the template expects, so text like
1,234.50works. - Fields you leave empty are left out. If you fill in nothing at all, CastPDF renders the template with its sample
data, which is handy for a first test.
A template without sample data has no fields to show. Add sample data to the template in CastPDF and reload the
fields, or set Data to JSON and give the whole data object, for example:
{
"invoice_number": "INV-1042",
"customer": { "name": "Ada Lovelace" },
"items": [{ "description": "Consulting", "quantity": 2, "price": 150 }]
}
With Map Automatically, every field of the input item is sent to the template. Fields the template does not use
are ignored.
Test mode
Turn on Test Mode while you build the workflow. It makes a free, watermarked test PDF that does not count toward
your plan, even with a live key. Turn it off when the workflow goes live. With a test key every PDF is a test PDF.
The trigger
- Webhooks are in the CastPDF Starter plan and above. On the Free plan, activating the workflow shows an error
that says so. - Activating the workflow adds a webhook endpoint named
n8n: PDF ready (workflow ...)in CastPDF under
Connect > Webhooks. Deactivating the workflow removes it. Each active
CastPDF Trigger uses one of the team's 10 webhook endpoints. - CastPDF only sends to public https addresses. A local n8n on
localhostcannot receive events. Use n8n Cloud, a
server with a public https address, or a tunnel. - A live key hears about live PDFs, a test key about test PDFs. So PDFs made with Test Mode on do not start a
workflow whose trigger uses a live key. - Every request is checked against the
CastPDF-Signatureheader with the endpoint's signing secret, which the node
keeps when it creates the endpoint. Requests without a valid, recent signature are refused.
Example workflow
Create an invoice PDF for every new paid order and email it:
- Shopify Trigger (or any trigger with order data).
- CastPDF: PDF > Create From Template, your invoice template, map the customer and the order lines, turn on
Download PDF File. - Gmail: Send, attach the binary field
data.
Resources
- n8n community nodes documentation
- CastPDF documentation
- CastPDF API reference
- CastPDF webhooks
- Support: support@castpdf.com
Version history
- 0.1.0: first release. CastPDF node (Create From Template, Create From HTML, Template Get and Get Many) and
CastPDF Trigger (PDF ready, PDF failed).