External module merge multiple PDFs into a single PDF

I need to add some pdf files to a single file. I am not able to use I do not have much knowledge. I am learning. does not work. no error is returned. tried to add the external module easy-pdf-merge and use it in the node function follow my steps:

  1. docker run -it --rm --name n8n -p 5678:5678 -e NODE_FUNCTION_ALLOW_EXTERNAL=easy-pdf-merge -v ~/.n8n:/root/.n8n n8nio/n8n

  2. /usr/local/lib/node_modules/n8n # npm install --save easy-pdf-merge

  3. saved /tmp/File_1.pdf and /tmp/File_2.pdf


const merge = require('easy-pdf-merge');

merge(['/tmp/File_1.pdf', '/tmp/File_2.pdf'], '/tmp/File_Merged.pdf', function (err) {
    if (err) {
        return console.log(err)
    console.log('Successfully merged!')

return [{ json: {} }]

My node:

  "nodes": [
      "parameters": {
        "functionCode": "const merge = require('easy-pdf-merge');\n\nmerge(['File One.pdf', 'File Two.pdf'], 'File Ouput.pdf', function (err) {\n    if (err) {\n        return console.log(err)\n    }\n    console.log('Successfully merged!')\n});\n\nreturn [{ json: {} }]\n"
      "name": "Function12",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
  "connections": {}

I accept other alternatives to be able to join pdf files to a single.

1 Like

Welcome to the community @Rodrigo_Meyer!

Probably best if you build your own custom image based on the one of n8n.

So you create a file named “Dockerfile” with this content:

FROM n8nio/n8n

RUN npm install -g easy-pdf-merge

In the same folder you execute then this command to build it:

docker build -t n8n-pdf 

If you then use this image and start n8n like this:

docker run -it --rm --name n8n -p 5678:5678 -e NODE_FUNCTION_ALLOW_EXTERNAL=easy-pdf-merge -v ~/.n8n:/root/.n8n n8n-pdf

the library should theoretically be accessible.

Joined PDFs. I used the image of the Docker n8n-ubuntu and adapted it according to your answer and added the java.

Thank you really showed the way.