Extract text from PDFs, including scanned ones
A text file for every PDF in a folder: typed letters, a two-column newsletter and scans.
A real run on 14 November 2026, on a Linux computer, using Claude Code with Opus, on a Claude plan. The waiting is sped up; it took 2 min 28 s in real time.
The short answer.
For a PDF with real text, select all and copy, or open it in Word on Windows, which converts it to editable text. Scans are pictures, so they need OCR: on a Mac, Preview's Live Text lets you select words in the image; the free Tesseract does whole files. Stella (stella.sh) handles a whole folder: it copies the text where there is some, runs OCR on scans and saves a .txt next to each PDF.
Stella does this on Windows, Mac and Linux.
What happened.
Nine text files in about 2½ minutes. Checked afterwards against an answer key written before the run: the text of all 9 PDFs within tight error limits (scans included), the two-column newsletter read column by column, one file per PDF named after it, and every PDF unchanged.
The planning documents, the neighbours and the newsletter are fictitious, made for this run; the three scans were printed as slightly skewed, grainy images. The work is sped up 8×.
How Stella does it.
- Opens all 9 PDFs in the Planning documents folder and sorts them: six have real text, three are image-only scans
- Copies the text out of the six typed PDFs exactly, reading the two-column newsletter left column first, then right, so sentences don't interleave
- Runs OCR on the three scans (a site visit note, a 1964 deeds extract and a signed consent) and checks the result against each page image
- Saves a .txt file with the same name next to each PDF; the PDFs themselves are unchanged
- Reports which ones were scans and that nothing came out garbled
The prompt.
I've got a folder of planning PDFs in my Downloads called Planning documents. Some are scans. Get the text out of every one of them, so I can search and copy it, and save it as a text file for each PDF.
This is the exact prompt from the recording. If your files are somewhere else, say where.
Do it yourself.
PDFs with real text
If you can select words in the PDF, the text is there: select all (Command-A or Ctrl-A), copy, and paste into a plain text editor. In a two-column layout check the order; some viewers copy across both columns line by line.
Windows: open the PDF in Word
Word opens PDFs and converts them to editable text (it says so when it opens). Then File, Save As, Plain Text. Scanned pages come through as text too, with mistakes on poor scans.
Mac: Live Text in Preview
On a scan, Preview lets you select text inside the page picture with Live Text. Select, copy and paste page by page. It's fine for a page or two, slow for a folder.
Many files: Tesseract
The free Tesseract OCR engine runs from the command line on Mac, Windows and Linux. It reads images, so turn each scanned page into a PNG first (or use a tool like OCRmyPDF that does it for you), then run
tesseract page.png out.
Where it stops.
- Handwriting and very poor scans come out with mistakes; Stella checks OCR text against the page and says where it's unsure.
- Tables come out as lines of text, not columns. For a spreadsheet, see extract a table from a PDF to Excel.
- Text and page images go to the AI model you use in Stella as it checks the result; the OCR itself runs on your computer.
- Recorded on Linux, where the OCR engine and PDF tools were already installed. On a Mac or Windows PC Stella may install Tesseract first; scans in languages other than English need their language pack added.
Questions.
How do I make a scanned PDF searchable instead of getting a text file?
Add a hidden text layer to the PDF itself: see make a scanned PDF searchable.
Why does copied text come out jumbled?
Usually columns: the copy runs straight across both. Or the PDF stores letters in an odd order. Extracting by column, as Stella did with the newsletter, fixes the first.
Can I get the text into Word with the layout?
Yes: convert a PDF to Word keeps headings, tables and pictures, where a text file keeps only the words.
Is Stella free for this?
Yes. Free with the ChatGPT or Claude plan you already have. Sign in with your ChatGPT plan, or use your Claude plan through Claude Code, and this task costs nothing extra. New accounts also get a small free trial of Stella’s own models.
Can I control what Stella changes on my computer?
Yes. Stella works on Windows, Mac and Linux with your own files and shows each step in the chat, so you can watch it and stop it at any point. Tell it what it may not do, as the prompts on these pages do (“don't delete anything without asking”). In the Downloads recording it deleted nothing until it was told to go ahead. It also refuses commands that would wipe a whole disk, your home folder or system folders.
- Apple: Interact with text in a photo using Live Text in Preview on Mac
- Microsoft: Opening PDFs in Word
- Tesseract OCR: installation
Checked against these sources on 14 November 2026.