Nodes/ComfyUI-Documents/PDF Page Splitter
ComfyUI Node

PDF Page Splitter

Pulling specific pages out of a PDF as images

By Excidos·Created 2 years ago·Updated 2 years ago· 67
PDF Page Splitter
    • selected_pages
    file_path
    page_numbers1,2,3
    dpi300

    This is PDF to Image's sibling, and the difference between the two comes down to one field. PDF to Image wants a contiguous range - start page, end page, everything in between. This node wants a list: page 1, page 5, pages 9 through 11, and nothing else. If you're pulling a handful of relevant pages out of a fifty-page report and don't want to render (or pay the memory cost of) the other forty-five, this is the node.

    How it works

    Same rendering engine as the rest of the pack - PyMuPDF rasterizes each requested page to an image tensor at the DPI you set. The difference is entirely in how you tell it which pages you want.

    The inputs and outputs that matter

    • file_path - the PDF, from the dropdown of files sitting in your ComfyUI input folder.
    • page_numbers - a string, defaulting to 1,2,3. The README documents the syntax explicitly: comma-separated page numbers and/or hyphenated ranges, e.g. 1,3,5 or 1-5,7,9-11. Pages are 1-indexed - there's no page 0.
    • dpi - 72 to 600, defaulting to 300, same trade-off as PDF to Image: higher DPI means sharper text but bigger, slower renders.

    The output is selected_pages, an IMAGE list - one tensor per page you specified, in the order you listed them. It's also flagged as an output node internally, which just means ComfyUI will run and surface it even if you haven't wired anything downstream yet, so it doubles as a quick way to preview specific pages of a PDF without building out the rest of your graph first.

    Installing it

    Through ComfyUI Manager: search ComfyUI-Documents, install, restart. Or manually:

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

    That requirements file is what pulls in PyMuPDF, the actual PDF engine underneath this whole pack. Nothing GPU-bound about this node - it's CPU-side rendering, so it works the same whether you're on a beefy card or a laptop.

    Where people get burned

    This is a small, one-person pack (the author built it as their first custom node, mainly to get PDF content into agent/LLM workflows), so treat it as lightly-tested rather than battle-hardened:

    • Typos in page_numbers are the number one issue. It's a free-text string, so a stray space, a comma where you meant a hyphen, or an accidental 0 (there is no page 0) will either error or quietly select the wrong pages. Double-check the string before you queue a big render.
    • Requesting a page past the document's actual length errors out rather than being skipped - same behavior as PDF to Image. If you're not sure how many pages your PDF has, check that first.
    • High DPI on a long, scattered page list adds up fast. selected_pages holds a full image tensor per requested page, so asking for a dozen pages at 600 DPI is a dozen large images in memory at once. Drop to 150–300 DPI unless you specifically need the extra detail.
    • If you actually want every page in a straight range rather than a hand-picked list, PDF to Image is the simpler node for that - you set a start and end page instead of typing out the whole sequence.
    Categorydocument_processing

    Inputs (3)

    NameTypeDefaultDescription
    file_pathCOMBO0 options:
    page_numbersSTRING1,2,3
    dpiINT30072–600

    Outputs (1)

    NameTypeDescription
    selected_pagesIMAGE