This is an n8n community node that provides functionality to convert DOCX templates to populated DOCX and PDF files. It allows users to fill in template variables in DOCX files with real data and then convert the resulting document to PDF format.
- Load DOCX templates with placeholders/variables
- Populate templates with JSON data
- Save the populated DOCX files
- Convert the populated DOCX files to PDF format
- Comprehensive error handling for all operations
Follow these steps to install this custom node:
-
Clone this repository:
git clone https://github.com/yourusername/n8n-nodes-docx-to-pdf.git
-
Navigate to the project directory:
cd n8n-nodes-docx-to-pdf
-
Install dependencies:
pnpm install
-
Build the code:
pnpm build
-
Create a symbolic link in your n8n installation:
npm link
-
In your n8n installation directory:
npm link n8n-nodes-docx-to-pdf
Once published, you can install this node globally using npm:
npm install n8n-nodes-docx-to-pdf -g
Or if you use n8n desktop app, install it through the Community Nodes tab.
- Add the DocxToPdf node to your workflow.
- Configure the following settings:
-
Template File: Path to your DOCX template file with variables in the format
{{ variableName }}
- Output DOCX File: Path where you want to save the populated DOCX file
- Output PDF File: Path where you want to save the converted PDF file
- JSON Data: JSON object with key-value pairs that match the variables in your template
-
Template File: Path to your DOCX template file with variables in the format
Your DOCX template might include variables like:
Dear {{ name }},
Thank you for your {{ product }} order.
Your order number is {{ orderNumber }}.
Best regards,
{{ companyName }}
{
"name": "John Doe",
"product": "Premium Subscription",
"orderNumber": "ORD-12345",
"companyName": "Your Company Name"
}
To publish this node to npm, follow these steps:
-
Update package.json with your information:
- Update the
name
,author
,repository
, andhomepage
fields - Make sure the version is correct
- Update the
-
Build the package:
pnpm build
-
Login to npm:
npm login
-
Publish the package:
npm publish
This project is licensed under the MIT License - see the LICENSE.md file for details.