ComfyUI Node

FL PDF Merger

Stitch two PDFs together mid-workflow

By filliptm·Created 3 years ago·Updated about 17 hours ago· 628
FL PDF Merger
  • pdf1
  • pdf2
  • PDF

Fill-Nodes is one of those sprawling grab-bag packs - one dev (filliptm, who goes by Machinedelusions) building whatever they personally needed and shipping it as a single install. It's got image VFX, GPT/Gemini/Runway wrappers, audio-reactive effects, and a whole little PDF subsystem tucked inside it. FL_PDFMerger is the join point in that PDF subsystem: it takes two PDF objects and glues them into one.

The thing to understand first is that "PDF" here isn't a file path, it's a custom ComfyUI type this pack defines - an in-memory object carrying the binary bytes plus metadata like page count. You get one out of FL_PDFLoader, FL_TextToPDF, FL_ImagesToPDF, or another FL_PDFMerger, and you feed it into things like FL_PDFSaver or FL_PDFTextExtractor downstream. FL_PDFMerger just sits in the middle of that chain, combining two of them into one.

How it works

Under the hood it's PyPDF2's PdfMerger - genuinely one of the more boring, solved problems in this pack. It appends the second PDF's pages after the first's and hands back a merged in-memory PDF object with the summed page count. No reflow, no re-layout, just pages stacked in order.

The inputs and outputs that matter

There are exactly two inputs, both required, and no optional knobs at all:

  • pdf1 and pdf2 - both type PDF. Order matters: pdf1's pages come first, pdf2's pages are appended after.

The single output is a PDF object with the combined pages - wire it into FL_PDFSaver to write it to disk, into FL_PDFMerger again if you need to stack a third document, or straight into FL_PDFTextExtractor / FL_PDFToImages if you just need the combined content and never plan to save the file itself.

How to install it

Through ComfyUI Manager: search "Fill-Nodes" (or the repo name, "ComfyUI_Fill-Nodes"), install, and restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
pip install -r ComfyUI_Fill-Nodes/requirements.txt

then restart ComfyUI. The PDF nodes specifically lean on PyPDF2 (merging, encryption, text extraction) and ReportLab/PyMuPDF elsewhere in that category - installing the pack pulls all of it in together even though this one node only needs PyPDF2. That's the nature of a monolith pack: you get the whole toolbox for one hammer.

Common issues & troubleshooting

It only takes two PDFs. There's no list input, no batch mode - if you need to merge three or more documents, chain FL_PDFMerger nodes: merge A+B, then feed that result into a second merger alongside C. It's clunky for a big stack of files but fine for the two-or-three-document case this node is actually built for.

Feeding it a file path instead of a PDF object. Because pdf1/pdf2 are the pack's PDF type, not STRING, you can't just type a path in - you need an upstream node (FL_PDFLoader for one file, FL_BulkPDFLoader for a directory) actually producing the typed object. If the node won't connect, that mismatch is almost always why.

Nothing shows up until you save it. Merging happens entirely in memory - the output is just bytes and a page count, not a file on disk. If you want to actually see the result, the merge has to end at FL_PDFSaver (or get extracted/rendered by one of the other PDF nodes) somewhere downstream.

Category🏵️Fill Nodes/PDF

Inputs (2)

NameTypeDefaultDescription
pdf1PDF
pdf2PDF

Outputs (1)

NameTypeDescription
PDFPDF