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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-pdf-merge

v1.2.3

Published

A Node-RED node to merge multiple PDFs into a single PDF

Downloads

23

Readme

Node-RED PDF Merge Node

Description

This Node-RED node allows you to merge multiple PDF files into a single PDF. It uses the pdf-lib library for processing and merging the PDFs. The node is compatible with both x86 and ARM-based systems.

Features

  • PDF Merging: Combines multiple PDF files into a single file.

  • Relative and Absolute Paths: Supports both relative paths based on the Node-RED data directory and absolute paths.

  • Flexible Storage Location: Allows specifying where the merged PDF should be saved, either through configuration or dynamically in the flow.

Installation

To install this node, use the Node-RED Palette Manager or install it directly via npm:

npm install node-red-contrib-pdf-merger

Usage

The inputs can be made directly in the node or transferred as a payload.

It is important that the payload is transferred in the correct format. See the Flow Example below.

Configuration

Node Properties

  • Name (optional): A custom name for the node.

  • PDF List (Paths): A list of paths to the PDF files to be merged. Paths can be relative to the Node-RED data directory or absolute.

  • Output Filename (optional): The name of the output PDF file. Defaults to merged.pdf.

  • Output Path (optional): A relative or absolute path where the merged PDF should be saved. If not specified, the PDF will be saved in the Node-RED data directory.

Configuration Example

{
  "name": "My PDF Merger",
  "pdfList": "/data/PDFs/Dashboard.pdf,/data/PDFs/Dashboard2.pdf",
  "outputFilename": "merged_output.pdf",
  "outputPath": "/data/MergedPDFs"
}

Flow Example

Here is an example with transfer in the payload:

[
    {
        "id": "ab089b1a54159fe9",
        "type": "pdf-merge",
        "z": "5e8e11b7e36a10d3",
        "name": "My PDF Merger",
        "pdfList": "",
        "outputFilename": "",
        "outputPath": "",
        "x": 1100,
        "y": 880,
        "wires": [
            [
                "1eda07b4df1d8e50"
            ]
        ]
    },
    {
        "id": "6fc65def4a16bf92",
        "type": "inject",
        "z": "5e8e11b7e36a10d3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 780,
        "y": 880,
        "wires": [
            [
                "2c7065b5cf7197d0"
            ]
        ]
    },
    {
        "id": "2c7065b5cf7197d0",
        "type": "function",
        "z": "5e8e11b7e36a10d3",
        "name": "function 35",
        "func": "msg.payload = {};\nmsg.payload.pdfPaths = [\n    \"/PDFs/Dashboard.pdf\",\n    \"/PDFs/Dashboard2.pdf\"\n]\nmsg.payload.outputPath = \"/data/MergedPDFs\";\nmsg.payload.outputFilename = \"merged_output.pdf\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 930,
        "y": 880,
        "wires": [
            [
                "ab089b1a54159fe9"
            ]
        ]
    },
    {
        "id": "1eda07b4df1d8e50",
        "type": "debug",
        "z": "5e8e11b7e36a10d3",
        "name": "debug 202",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "counter",
        "x": 1235,
        "y": 880,
        "wires": [],
        "l": false
    }
]

Here is an example with the node configuration only:

[
    {
        "id": "e5bce75f.60a5b8",
        "type": "pdf-merge",
        "z": "9c9b7c18.5498b8",
        "name": "Merge PDFs",
        "pdfList": "/PDFs/Dashboard.pdf, /PDFs/Dashboard2.pdf",
        "outputFilename": "merged_output.pdf",
        "outputPath": "/data/MergedPDFs",
        "x": 480,
        "y": 160,
        "wires": [
            [
                "9a1c9b6f.9d9c6"
            ]
        ]
    },
    {
        "id": "9a1c9b6f.9d9c6",
        "type": "debug",
        "z": "9c9b7c18.5498b8",
        "name": "Debug Output",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 640,
        "y": 160,
        "wires": []
    }
]

Usage

  1. Add the pdf-merge node to your flow.

  2. Configure the paths to the PDF files you want to merge.

  3. Set the name and storage location for the output PDF file.

  4. Connect the node to other nodes in the flow and deploy your changes.

The node will merge the specified PDF files and save the resulting PDF at the specified location.

Troubleshooting

  • File Operation Errors: Ensure that the paths provided are correct and that Node-RED has the necessary permissions to read and write the files.

  • Performance Issues: Check your system's resources, especially if processing large PDFs or merging many PDFs.

License

This node is licensed under the MIT License.