n8n community node to convert DOCX/Word documents to PDF using LibreOffice. Preserves all formatting, images, tables, and layout with perfect fidelity.
npm install n8n-nodes-docx-to-pdfConvert Word documents (DOCX) to PDF using LibreOffice. Preserves all formatting, images, tables, headers, footers, and layout with perfect fidelity.


✅ Perfect Quality - Uses LibreOffice for professional-grade conversions
✅ Preserves Everything - Images, tables, formatting, headers, footers
✅ Free Forever - No API costs, no usage limits
✅ Works Offline - No internet connection required
✅ Batch Processing - Convert multiple files in one workflow
✅ Flexible Output - Custom filenames, keep original files
LibreOffice must be installed on your system.
bash
sudo apt-get update
sudo apt-get install -y libreoffice
`$3
`bash
brew install libreoffice
`$3
If running n8n in Docker, use this Dockerfile:
`dockerfile
FROM n8nio/n8n:latestUSER root
RUN apt-get update && \
apt-get install -y libreoffice && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER node
`Build and run:
`bash
docker build -t n8n-with-libreoffice .
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8n-with-libreoffice
`$3
Add to your
docker-compose.yml:`yaml
services:
n8n:
image: n8nio/n8n:latest
user: root
environment:
- N8N_PROTOCOL=http
- N8N_HOST=localhost
- N8N_PORT=5678
ports:
- 5678:5678
volumes:
- ~/.n8n:/home/node/.n8n
command: >
sh -c "apt-get update &&
apt-get install -y libreoffice &&
su node -c 'n8n start'"
`Installation
$3
1. Go to Settings > Community Nodes
2. Click Install
3. Enter: n8n-nodes-docx-to-pdf
4. Click Install$3
`bash
cd ~/.n8n/custom
npm install n8n-nodes-docx-to-pdf
`$3
`bash
Clone or download this repository
cd n8n-nodes-docx-to-pdf
npm install
npm run buildLink to n8n
npm link
cd ~/.n8n/custom
npm link n8n-nodes-docx-to-pdf
`Usage
$3
`
[Read Binary Files] → [DOCX to PDF] → [Write Binary Files]
`$3
Input Binary Property
Name of the binary property containing your DOCX file (default:
data)Output Binary Property
Name of the binary property where the PDF will be stored (default:
data)Output Filename (optional)
Custom filename for the PDF. If empty, uses the original filename with
.pdf extension.$3
`
[Google Drive - Download]
↓
[DOCX to PDF]
↓
[Google Drive - Upload]
`$3
`
[Gmail Trigger - New Email]
↓
[Extract Attachments]
↓
[Filter: .docx files]
↓
[DOCX to PDF]
↓
[Send Email - with PDF]
`$3
`
[Webhook] - receives DOCX upload
↓
[DOCX to PDF]
↓
[Return PDF to client]
`Options
$3
Enable this option to keep the original DOCX file alongside the PDF in the binary data. Useful when you need both versions.Output Data
The node adds these properties to the JSON output:
`json
{
"filename": "document.pdf",
"originalFilename": "document.docx",
"fileSize": 245680,
"mimeType": "application/pdf"
}
`Error Handling
The node will throw an error if:
- LibreOffice is not installed
- The input file is corrupted or not a valid DOCX
- The system runs out of memory
Enable Continue On Fail in the node settings to handle errors gracefully in production.
Performance
- Small files (<1MB): ~1-2 seconds
- Medium files (1-5MB): ~2-5 seconds
- Large files (>5MB): ~5-15 seconds
Performance depends on document complexity and server resources.
Troubleshooting
$3
Check if LibreOffice is installed:
`bash
which libreoffice
or
which soffice
`If not installed, follow the installation instructions above.
Docker users:
Make sure your Dockerfile includes LibreOffice installation. Rebuild your image:
`bash
docker build -t n8n-with-libreoffice .
`$3
1. Restart n8n completely
2. Clear browser cache
3. Check if the node is installed:
`bash
ls ~/.n8n/custom/node_modules/n8n-nodes-docx-to-pdf
`$3
LibreOffice provides the best quality available. If you're experiencing issues:
- Make sure you're using a recent version of LibreOffice
- Check if the DOCX file opens correctly in LibreOffice manually
- Some very complex documents may need adjustment
$3
For very large documents (>50MB), increase Node.js memory:
`bash
export NODE_OPTIONS="--max-old-space-size=4096"
n8n start
`Supported File Types
-
.docx (Word 2007 and later)
- .doc (Word 97-2003) - also supported
- .odt (OpenDocument Text) - also supportedComparison with Alternatives
| Solution | Quality | Cost | Setup | Dependencies |
|----------|---------|------|-------|--------------|
| This Node (LibreOffice) | ⭐⭐⭐⭐⭐ | Free | Medium | LibreOffice |
| Cloud APIs (ConvertAPI, etc.) | ⭐⭐⭐⭐⭐ | Paid | Easy | None |
| Pure JS libraries | ⭐⭐ | Free | Easy | None |
Development
`bash
Install dependencies
npm installBuild
npm run buildWatch mode
npm run devLint
npm run lintFormat
npm run format
``Contributions are welcome! Please open an issue or submit a pull request.
MIT
- n8n Community Forum
- GitHub Issues
Built with:
- libre-office-convert
- LibreOffice
- n8n
---
Made with ❤️ for the n8n community