Nodes/ComfyUI PDF Nodes/Load PDF 📄
ComfyUI Node

Load PDF 📄

Load, decrypt, and count

By orion4d·Created about a year ago·Updated about a year ago· 1
Load PDF 📄
    • pdf_pages
    • page_count
    pdf_pathinput/example.pdf
    password

    Load PDF 📄 is the front door to the whole ComfyUI PDF Nodes pack. Everything else - extracting text, merging, rotating, saving - needs a PDF_PAGES wire, and this is the only node that makes one from an actual file on disk. No workflow in this pack works without it, so if you're new, this is the first node you'll place and the one you'll blame when nothing else lights up.

    What it does

    You give it a path to a PDF, and it reads the file with pypdf, returning two things:

    • pdf_pages (type PDF_PAGES) - a list of page objects. This is the pack's internal currency; it only plugs into the other nodes in this pack, so don't expect it to connect to anything else in ComfyUI.
    • page_count (INT) - how many pages the document has, a convenience so you don't need a separate count node right at the start.

    The name is the honest part: it just loads. No API calls, no model downloads, no GPU. It's pypdf reading a file and handing you the pages.

    The inputs that matter

    • pdf_path (STRING, default input/example.pdf) - the path to your file. Here's the trap: it's relative to your ComfyUI root folder, not the node's folder. So input/example.pdf means ComfyUI/input/example.pdf. Drop your file in ComfyUI/input/ and that default just works, or type an absolute path like C:\Users\you\docs\contract.pdf and stop worrying about where ComfyUI thinks it is.
    • password (STRING, optional) - for encrypted PDFs. Leave it empty for normal files. If you hit a locked PDF, this is where you type the password.

    How it fails (and it fails quietly)

    This node does not throw. If the file is missing, it prints ERROR: PDFLoadNode: File not found at ... to the console and returns an empty list and 0. Same for a wrong password - FileNotDecryptedError gets caught and swallowed into an empty return. So when you wire pdf_pages somewhere and get nothing out the other end, your first move is to read the console, not to rebuild the workflow. ComfyUI's habit of failing fast is great; this pack's habit of returning empties is why the console matters.

    Install

    Via ComfyUI Manager: search "ComfyUI PDF Nodes" and install. Or by hand:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/orion4d/ComfyUI_pdf_nodes.git
    cd ComfyUI_pdf_nodes
    pip install -r requirements.txt
    

    Then restart ComfyUI and you'll find all the PDF nodes under the PDF category. One genuinely useful detail: PDFLoad itself only needs pypdf. PyMuPDF and Pillow are in the requirements for the image-rendering nodes (PDFPreviewPage, PDFPagesToImages), so if you're only doing text and page manipulation, you could get away with just pypdf - but the one-line pip install -r requirements.txt installs all three, and that's the path of least resistance. ComfyUI Manager does this for you.

    Where it fits

    A typical first workflow: Load PDFExtract Text (Select Pages) → done, or Load → Rotate → Save when you're fixing a scanned document that came in sideways. The page_count output is handy for wiring into logic - say, "only run this if the document is more than one page." It's a plain utility node with a plain job, and once you've placed it once you'll never think about it again.

    CategoryPDF

    Inputs (2)

    NameTypeDefaultDescription
    pdf_pathSTRINGinput/example.pdf
    passwordoptSTRING

    Outputs (2)

    NameTypeDescription
    pdf_pagesPDF_PAGES
    page_countINT