Nodes/ComfyUI MarkItDown/PDF to Markdown
ComfyUI Node

PDF to Markdown

PDF to text for your LLM — as long as the PDF is actually text

By ciga2011·Created 2 years ago·Updated about a year ago· 9
PDF to Markdown
    • markdown
    source_file

    Somewhere in your workflow you have a PDF full of text you'd rather have as Markdown - a paper, a spec, a report - so you can feed it to an LLM node or index it. This is the node for that, with one caveat carved in stone: it only extracts text. If your PDF is a set of scanned pages, the output is empty and no amount of tweaking will fix it.

    How it works

    The WIZ_PDF2MARKDOWN node is a strict subclass of the pack's generic MarkItDown node. Same mechanism - MarkItDown().convert(path) returns the text content - but with an extension whitelist of exactly .pdf, and anything else raises Only support: ['.pdf']. The conversion itself is handled by pdfminer-six, the text-extraction library that markitdown 0.0.1a3 bundles. It pulls the text layer out of the PDF and renders it into Markdown: headings and paragraphs mostly survive; tables and multi-column layouts tend to come out flattened and slightly mangled. It's extraction, not typesetting, and you should set expectations accordingly.

    The inputs and outputs that matter

    One input: source_file, a STRING with an absolute path to your .pdf. Paste it in - there's no file browser in this pack, just a text field. One output: markdown, a STRING you can wire into any text viewer, save-text node, or LLM context node. That's the entire surface area of the node.

    Why you'd reach for it

    The niche it fills: turning a text-based PDF into something an LLM can actually ingest cleanly. Feeding a raw PDF into most LLM helper nodes works poorly; feeding Markdown works well. It's also handy for pulling quotes or facts out of a document without opening a reader. Just don't expect the fancy stuff - no OCR, no layout reconstruction, no image descriptions.

    Installing it

    It ships in the ComfyUI-MarkItDown pack, so install that once: ComfyUI Manager, search "ComfyUI MarkItDown", install, restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ciga2011/ComfyUI-MarkItDown
    

    The PDF support comes from markitdown's own transitive dependencies - no model downloads, no GPU. One of the lighter installs in your custom_nodes folder.

    Gotchas

    The scanned-PDF wall is the big one: no text layer means no output. If you're stuck with scans, run them through OCR elsewhere first and convert the resulting text. Also watch the whitelist - the sibling generic WIZ_MARKITDOWN node accepts any extension markitdown understands, while this one is locked to .pdf, so a mislabeled file errors out with that Only support message. And don't go bumping the pinned markitdown==0.0.1a3 version to chase better PDF handling; newer markitdown behaves differently and the pack's other nodes depend on the old API.

    CategoryMarkItDown

    Inputs (1)

    NameTypeDefaultDescription
    source_fileSTRING

    Outputs (1)

    NameTypeDescription
    markdownSTRING