Nodes/ComfyUI-DeepseekOCR-easy/📄 Load PDF from Path
ComfyUI Node

📄 Load PDF from Path

Load a PDF into ComfyUI without screenshotting every page

By swan7-py·Created 9 months ago·Updated 9 months ago· 4
📄 Load PDF from Path
    • IMAGE
    pdf_absolute_path
    start_page1
    end_page1

    This is the boring half of the DeepSeek-OCR pack, and I mean that as a compliment. LoadPDFtoImage just turns a PDF sitting on your disk into a batch of IMAGE tensors - one per page - so the OCR node can actually read them. ComfyUI has no native "open this file" concept; it works on tensors flowing between nodes, so you need something like this whenever your source material isn't an image you loaded through the usual image node. Screenshotting a 50-page document by hand is not a workflow. This is.

    How it works

    The mechanism is refreshingly unglamorous. It uses pypdf to count the pages, then pdf2image's convert_from_path to rasterize the page range you ask for. That call shells out to Poppler's pdftoppm under the hood - the node itself never renders anything. Each page becomes a PIL image, gets converted to RGB and normalized to 0–1 floats, and the whole set is stacked into one batched tensor of shape (N, H, W, C). One tensor in, ready to feed the OCR node.

    The inputs

    • pdf_absolute_path (STRING) - paste the path. Quotes around it get stripped automatically, and relative paths resolve against ComfyUI's working directory, so giving an absolute path is the least surprising option. It must end in .pdf and exist, or you get a clear error.
    • start_page (INT, default 1) - first page to rasterize.
    • end_page (INT, default 1) - last page. Defaults to 1, meaning just page one unless you widen it.

    The validation is friendly: it rejects ranges outside 1 ≤ start ≤ end ≤ total pages before rendering a single frame, which beats a silent half-output.

    The single output is a standard IMAGE batch - wire it straight into the images input of DeepSeekOCRNode and you're done.

    Installing it

    Same story as the rest of the pack - clone into custom_nodes and restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/swan7-py/ComfyUI-DeepseekOCR-easy.git
    

    The catch is system-level. pdf2image is a Python wrapper, but the actual rasterization is done by Poppler, which is not a pip package. On Ubuntu/Debian:

    sudo apt install poppler-utils
    

    Windows users grab poppler-windows, unzip it, and add its bin folder to the system PATH. Forget this step and the node fails with an error about not finding pdftoppm - which confuses people every single time, because pip installed just fine and the node still breaks.

    Gotchas

    Beyond the Poppler requirement, the practical limits are yours: pages rasterize at the PDF's native resolution, so a huge page produces a huge tensor, and a big page range means a big batch. Since the OCR node processes the whole batch on the GPU at once, feeding it a 200-page scan in one go is asking for VRAM trouble - keep the range to what you actually need. Also note this node only reads from a file path; no drag-and-drop, no URL. That's it - a tiny, single-purpose loader that does one job and does it without fuss.

    CategorySwanOCR

    Inputs (3)

    NameTypeDefaultDescription
    pdf_absolute_pathSTRING
    start_pageINT11–9999
    end_pageINT11–9999

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE