Nodes/ComfyUI_Fill-Nodes/FL PDF Text Extractor
ComfyUI Node

FL PDF Text Extractor

Pull the text out of a PDF inside ComfyUI

By filliptm·Created 3 years ago·Updated about 6 hours ago· 628
FL PDF Text Extractor
  • pdf
  • STRING

Once you've loaded a PDF into ComfyUI (with FL_PDFLoader or FL_BulkPDFLoader), this is the node that reads the words out of it. FL_PDFTextExtractor takes a PDF object and returns its full text as a plain STRING - every page, concatenated. From there the text is just a string like any other in your graph: feed it into a prompt, hand it to an LLM node for summarizing, save it, or use it to drive generation. It's the "turn this document into text I can work with" step.

Why would you want text in an image-generation tool at all? Because Fill-Nodes leans toward pipelines that mix documents and media - building prompts or caption corpora from reference material, extracting instructions from a brief, feeding document contents into a text-to-image or LLM step. If your workflow never touches PDFs, you'll never need this; if it does, it's the obvious tool.

How it works

It walks every page of the PDF using PyPDF2's text extraction and stitches the results together, separating pages with double newlines so you can tell where one ends and the next begins. The output is one STRING containing the whole document's text. No OCR, no layout reconstruction - it reads the text layer that's already embedded in the PDF.

The inputs and output

  • pdf - a PDF object, as produced by FL_PDFLoader (single file) or FL_BulkPDFLoader (a folder). That custom PDF type is the only thing that fits here.

Output is a single STRING with the extracted text, pages joined by blank lines. Wire it into whatever consumes text.

Installing it

Part of the Fill-Nodes pack. ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes

then restart. The PDF nodes need PyPDF2, which the pack installs on load. And the loud "Machine Delusions" banner at startup is just the author's splash, not an error.

Where people get tripped up

  • Scanned PDFs return nothing - and that's not a bug. This is the big gotcha. PyPDF2 extracts the text layer. If your PDF is really a stack of scanned page images (a photographed contract, an old document), there's no text layer to read, and you'll get an empty or near-empty string. That job needs OCR, which this node does not do. Check whether you can select text in the PDF in a normal viewer - if you can't, this won't either.
  • It expects the Fill-Nodes PDF type, not a file path. You must load the PDF with FL_PDFLoader/FL_BulkPDFLoader first. Wiring a raw path or a string in won't work.
  • Extraction can be messy on complex layouts. Multi-column pages, tables, and heavy formatting often come out with the reading order scrambled. That's a limitation of text extraction generally, not this node specifically - clean up downstream if it matters.
  • If the node's missing from the menu, PyPDF2 probably didn't install. The usual dependency-clash symptom. Check the startup log.
Category🏵️Fill Nodes/PDF

Inputs (1)

NameTypeDefaultDescription
pdfPDF

Outputs (1)

NameTypeDescription
STRINGSTRING