Nodes/ComfyUI-Documents/PDF to Image (Multi-Page)
ComfyUI Node

PDF to Image (Multi-Page)

Rendering PDF pages as image tensors

By Excidos·Created 2 years ago·Updated 2 years ago· 67
PDF to Image (Multi-Page)
    • IMAGE
    file_path
    start_page1
    end_page1
    dpi300

    Document Loader gets you a PDF's text, but text extraction only works if the PDF has a text layer. Scanned documents, image-heavy pages, forms, anything where the "text" is really pixels - none of that survives a text parser. That's what this node is for: it renders a PDF page range straight to image tensors, so you can feed pages into a vision model, an OCR node, an upscaler, or just look at them.

    How it works

    Under the hood it's PyMuPDF doing the rendering - the same library that powers Document Loader's text extraction, just used here to rasterize instead of parse. You give it a file, a page range, and a resolution, and it hands back one image per page in that range.

    The inputs and outputs that matter

    Four fields, all required:

    • file_path - the PDF, picked from a dropdown of whatever's in your ComfyUI input folder (same convention as Load Image).
    • start_page / end_page - the contiguous page range to render, both 1-indexed. Set them equal to grab a single page. This node wants a range, not a scattered list - if you need pages 1, 5, and 9-11 with everything else skipped, that's a job for PDF Page Splitter instead.
    • dpi - rendering resolution, 72 to 600, defaulting to 300. This is the one setting that actually matters for output quality: 300 DPI is roughly print quality and plenty for most vision/OCR models to read normal body text. Push it toward 600 only if you're dealing with small or dense text and need every pixel - know that it also multiplies file size and render time, and a 20-page document at 600 DPI is a genuinely heavy batch.

    The output is a single IMAGE, but it's a list under the hood - one tensor per page in your range. Wire it into anything that takes a batch of images: a vision-LLM node for OCR-style reading, PreviewImage to just look at the pages, an upscaler, or a save node if you want the pages as standalone image files.

    Installing it

    Via ComfyUI Manager: search ComfyUI-Documents, install, restart. Manually:

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

    The only real dependency this node cares about is PyMuPDF, which the requirements file installs for you. No model downloads, no GPU needed for the rendering step itself - it's pure CPU rasterization.

    Where people get burned

    This is a small, single-author pack (it was literally the author's first custom node, built to bridge PDFs into LLM/agent workflows), so a few practical notes rather than a long horror list:

    • Ask for a page range beyond the document's real length and it'll error out. There's no visible clamping in the node - end_page past the actual page count just fails rather than silently truncating. Check your PDF's page count first if you're not sure.
    • DPI is a resolution knob, not a quality-fix knob. Cranking it up won't rescue an already-blurry scan; it'll just give you a bigger blurry image. Match DPI to what your downstream node actually needs to read, not higher "just in case."
    • Large multi-page ranges at high DPI eat memory fast. Since the output is a list of full images, a 50-page PDF at 600 DPI is 50 large tensors sitting in memory at once. If you're hitting OOM or things feel sluggish, drop the DPI or split the job into smaller page ranges rather than rendering the whole document in one go.
    • If your goal is genuinely just picking out a handful of specific pages rather than a whole range, PDF Page Splitter does that more directly and skips rendering pages you don't need.
    Categorydocument_processing

    Inputs (4)

    NameTypeDefaultDescription
    file_pathCOMBO0 options:
    start_pageINT11–10000
    end_pageINT11–10000
    dpiINT30072–600

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE