npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-docx-to-pdf

v1.0.2

Published

n8n community node to convert DOCX/Word documents to PDF using LibreOffice. Preserves all formatting, images, tables, and layout with perfect fidelity.

Readme

n8n DOCX to PDF Node

Convert Word documents (DOCX) to PDF using LibreOffice. Preserves all formatting, images, tables, headers, footers, and layout with perfect fidelity.

npm version License: MIT

Features

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

Prerequisites

LibreOffice must be installed on your system.

Ubuntu/Debian

sudo apt-get update
sudo apt-get install -y libreoffice

macOS

brew install libreoffice

Docker

If running n8n in Docker, use this Dockerfile:

FROM n8nio/n8n:latest

USER root
RUN apt-get update && \
    apt-get install -y libreoffice && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

USER node

Build and run:

docker build -t n8n-with-libreoffice .
docker run -it --rm \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8n-with-libreoffice

Docker Compose

Add to your docker-compose.yml:

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

In n8n (GUI)

  1. Go to Settings > Community Nodes
  2. Click Install
  3. Enter: n8n-nodes-docx-to-pdf
  4. Click Install

Manual Installation

cd ~/.n8n/custom
npm install n8n-nodes-docx-to-pdf

From Source

# Clone or download this repository
cd n8n-nodes-docx-to-pdf
npm install
npm run build

# Link to n8n
npm link
cd ~/.n8n/custom
npm link n8n-nodes-docx-to-pdf

Usage

Basic Workflow

[Read Binary Files] → [DOCX to PDF] → [Write Binary Files]

Configuration

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.

Example: Google Drive Integration

[Google Drive - Download] 
    ↓
[DOCX to PDF] 
    ↓
[Google Drive - Upload]

Example: Batch Email Attachments

[Gmail Trigger - New Email] 
    ↓
[Extract Attachments] 
    ↓
[Filter: .docx files]
    ↓
[DOCX to PDF] 
    ↓
[Send Email - with PDF]

Example: Webhook to PDF

[Webhook] - receives DOCX upload
    ↓
[DOCX to PDF]
    ↓
[Return PDF to client]

Options

Keep Original Binary

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:

{
  "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

"LibreOffice not found" error

Check if LibreOffice is installed:

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:

docker build -t n8n-with-libreoffice .

Node doesn't appear in n8n

  1. Restart n8n completely
  2. Clear browser cache
  3. Check if the node is installed:
    ls ~/.n8n/custom/node_modules/n8n-nodes-docx-to-pdf

Poor conversion quality

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

Memory issues with large files

For very large documents (>50MB), increase Node.js memory:

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 supported

Comparison 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

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Lint
npm run lint

# Format
npm run format

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT

Support

Credits

Built with:


Made with ❤️ for the n8n community