Nodes/ComfyUI PyMuPDF/Load PDF (PyMuPDF)
ComfyUI Node

Load PDF (PyMuPDF)

The front door to every other node in this pack

By Stone-dielianhua·Created 3 months ago·Updated 3 months ago· 1
Load PDF (PyMuPDF)
    • pdf
    ◄pdf▾►
    ◄mode▾►

    Every other node in the ComfyUI-PyMuPDF pack expects a PYMUPDF_PDF socket as its pdf input, and this is the node that makes one. You load a PDF here, and whatever you connect the pdf output to - the extractors, the renderer, the metadata reader - gets a reference to the file. It's the load-first step of any PDF workflow, and it's about as frictionless as file loading gets in ComfyUI.

    The nice part is the upload UX, which the README is right to brag about. Beyond the usual dropdown, the node has an upload button, accepts PDFs dragged onto it, accepts pasting a PDF while the node is selected, and even imports from a local path you copy to the clipboard. The node's front-end code routes those through two tiny endpoints (/pymupdf/upload_pdf and /pymupdf/import_pdf_path) that copy the file into ComfyUI/input/pymupdf/ so the rest of the pack can find it. That clipboard-path trick is the one I'd reach for: no hunting through file dialogs, just copy the path and paste it onto the node.

    The inputs that matter

    • pdf - the file picker. It lists every PDF under ComfyUI/input/pymupdf/, so it starts as just none until you upload or drop something.
    • mode - single loads the one file you picked. batch loads every PDF found in that input folder at once. Batch mode is the pack's little superpower: Extract PDF, Extract PDF Text, and Render PDF Pages all iterate over whatever this node hands them, so you can chew through a folder of documents in one run instead of building a loop.

    How it works

    The node is deliberately dumb - it resolves each filename, verifies it's a real PDF sitting inside the input directory, and hands back the list of names. The verification matters, because every downstream node re-checks it and will throw ValueError: PDF must be inside the ComfyUI input directory. if you sneak a path in from elsewhere. Security posture aside, it also means the whole pack is a "no model files to download" deal: the only dependency is PyMuPDF itself.

    Install

    Grab it via ComfyUI Manager (search "ComfyUI PyMuPDF"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Stone-dielianhua/ComfyUI-PyMuPDF
    pip install -r requirements.txt   # just installs PyMuPDF
    

    Then restart ComfyUI. The classic gotcha: PyMuPDF must be installed into the same Python environment ComfyUI runs in (the embedded portable one, or whichever venv you launch it from) - not your system Python. And install pymupdf, never fitz: there's a stale, unrelated fitz package on PyPI, and it's a rite of passage to pip install fitz, get a useless module, and blame the wrong thing when the node won't load.

    Common issues

    The two you'll actually hit: no PDFs listed (upload one first - the picker only shows files that are already in input/pymupdf/), and a node missing from the menu entirely (PyMuPDF isn't importable in ComfyUI's Python, almost always an environment mismatch). This is a young pack - v0.1.0, tiny install base - so treat rough edges as normal and file them on the GitHub repo. It's the one node in the pack you'll wire into every PDF workflow, which makes it the natural place to start.

    Categorypdf/PyMuPDF

    Inputs (2)

    NameTypeDefaultDescription
    pdfCOMBO1 options: none
    modeCOMBO2 options: single, batch

    Outputs (1)

    NameTypeDescription
    pdfPYMUPDF_PDF—