Extract Text (Select Pages) 🔍📄
The whole-document text extractor — page ranges, separators, and the scan trap
- pdf_pages
- STRING
Extract Text (Select Pages) 🔍📄 is the pack's big text pump: it takes a PDF_PAGES list, a page-selection string, and returns the combined text of all the selected pages as a single STRING. If your goal is "get this whole document into text form," this is the node you'll use 90% of the time. Wire its output into a text node, an LLM, a prompt builder, or just something you can copy from - the workflow possibilities are why this is the pack's most useful node.
The inputs that matter
pdf_pages(PDF_PAGES) - your loaded list.page_selection(STRING, defaultall) - the selection syntax. This is 1-indexed (unlike the single-page node's 0-indexedpage_index, which is a genuinely easy thing to mix up). It accepts:1,3,5- individual pages2-6- a range1,3-5,8- mixed, and this works fineall, or leave it empty - every page
separator(STRING, optional, default\n\n--- Page Break ---\n\n) - inserted between each page's text so you can tell where page boundaries fall in the combined output. If you're feeding an LLM, the default is good - it keeps pages distinct. If you want a clean wall of text, set it to a newline or empty.
How it works
The page-selection parser is shared across this pack (extract, rotate, and the batch image renderer all use the same one), and it's forgiving: invalid chunks are logged and skipped, out-of-range page numbers are clipped, and a selection that matches nothing returns an empty string. Internally each selected page gets extract_text() from pypdf, and the results are joined with your separator.
Two honest limitations. First, the same no-OCR caveat as everywhere in this pack: pypdf reads the embedded text layer, so scanned PDFs return empty text. Second, text-extraction quality varies wildly between PDFs - some exporters produce clean text, others produce glued-together fragments or dropped whitespace. That's a pypdf property, not a bug in this node; the fix is a different PDF, or OCR.
Common issues
- Empty output. Either the selection matched nothing, the load upstream failed, or the PDF is a scan. Check the console - the node logs
Extracted text from N selected pages. Total N chars. - Index off-by-one. You selected
2expecting the second page, butpage_selectionis 1-indexed, so2is the second page - and1is the first. The confusion only creeps in when you're also using the 0-indexed single-page node in the same workflow. Pick one mental model per node and stick to it. - No limit. Unlike the batch image node, text extraction has no
max_pages_to_rendercap, soallon a 500-page document will happily chew through all 500. Fine for text; just know it's not instant.
Install
Same pack, same drill:
cd ComfyUI/custom_nodes/
git clone https://github.com/orion4d/ComfyUI_pdf_nodes.git
cd ComfyUI_pdf_nodes && pip install -r requirements.txt
Or ComfyUI Manager → "ComfyUI PDF Nodes". Restart, find it under PDF. Only pypdf is needed for this node - no PyMuPDF, no Pillow. If you're building a "PDF to prompt" or document-summary workflow in ComfyUI, this is the node that makes it work.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| pdf_pages | PDF_PAGES | — | |
| page_selection | STRING | all | — |
| separatoropt | STRING | --- Page Break --- | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |