To convert a PDF to a TXT file, first try to select a sentence on the page. If the words select, the PDF has a text layer: copy and paste it, export it from Acrobat or Google Docs, or run pdftotext. If nothing selects, it's a scan, and it needs OCR before any of those methods returns a single word.
Is your PDF real text or a scanned image?
Drag across one line in the middle of a paragraph. If words select, the PDF has a text layer and every method here works. If nothing selects, or the whole page turns into one box, each page is an image that needs OCR (optical character recognition, which reads letters off a picture) first.
Or count words in a terminal:
pdftotext file.pdf - | wc -w
The test invoice made for this post printed 35; an image-only copy printed 0.
Check more than page one: the page that refuses to copy is often the signature page someone printed, signed and scanned back in, slightly crooked.
A PDF with text can still block copying with the author's security settings (Document Properties > Security in Acrobat Reader; Adobe Reader help) or a password (Apple Preview guide).
Which PDF to text method should you use?
Copy and paste is fine for a paragraph. For whole documents with a text layer, use Acrobat's TXT export, Google Docs or pdftotext. Scans need OCR (Google Drive for small files, ocrmypdf or Adobe's online tool for a searchable PDF), and inside a Zap or Make scenario both jobs go to an API.
| Method | Works on scans? | Keeps layout/order? | Free? | Best for |
|---|---|---|---|---|
| Copy and paste in Acrobat Reader | No | Partly; tables and columns can scramble | Yes | A paragraph or a quote |
| Adobe Acrobat: export to TXT | After Scan & OCR | No, plain text only | No (paid, free trial) | Acrobat subscribers |
| Mac Preview | No | Partly; Option-drag copies one column | Yes, built in | Quick Mac copies |
| Google Drive to Google Docs | Yes | Bold and line breaks likely; tables and columns likely lost | Yes | Scans up to 2 MB |
pdftotext (Poppler) | No | Default follows reading order; -layout keeps rows | Yes, open source | Batches and scripts |
Python pypdf | No | Default can interleave columns; layout mode keeps rows | Yes, open source | Python apps |
ocrmypdf | Yes | Page unchanged, hidden text layer added | Yes, open source | Searchable scans in bulk |
| ASHDOCS PDF to Text + OCR APIs | OCR API: yes | Described as order-preserving | Test keys free; live: 1 credit (text), 3 (OCR) | Zaps, scenarios, workflows |
How do I copy text from a PDF document?
Open the PDF, switch to the text selection tool, drag across what you need and copy it. Paste into a plain-text editor such as Notepad and save with a .txt extension. That works on any PDF with a text layer; on a scan nothing selects, so run OCR first.
Acrobat Reader (free). Right-click the page, choose Select Tool, drag across the text, then right-click and choose Copy (Adobe Reader help).
Mac Preview. Choose Tools > Text Selection, drag, then Edit > Copy. To copy other things from a PDF, hold Option while dragging to grab one table column, or use Tools > Rectangular Selection to copy a chart or logo as an image (Apple Preview guide).
Gibberish when you paste? The font may not map its glyphs to real characters; pdffonts file.pdf prints "yes" in the uni column for fonts that do (pdffonts man page). OCR sidesteps it by reading the page as an image (--force-ocr in ocrmypdf; OCRmyPDF docs).
Copying text out of every PDF in your inbox? Send them to the ASHDOCS PDF to Text API from a Zap, Make scenario or n8n workflow, on a free test key that never uses credits.
How do I convert a PDF to a TXT file?
Export the whole document. In Adobe Acrobat, choose Convert, pick TXT and save. For free, open the PDF in Google Docs from Google Drive and download it as Plain text (.txt), or run pdftotext file.pdf on a Mac or Linux machine. Of these, only the Google route runs OCR on scans.
Adobe Acrobat: export PDF as text
In Acrobat desktop, select Convert from the global bar, then Other format, TXT and Convert to TXT; Settings sets the encoding (Adobe Acrobat help). Adobe also lists File > Export a PDF > Text (Plain), and Acrobat Pro "includes local conversion options", so nothing has to go online (Adobe).
Acrobat is paid (free trial); Adobe says the free Reader needs a paid Export PDF subscription to export to Word, Excel or RTF (Adobe Reader help).
Google Docs (free, handles scans)
- Upload the PDF to Google Drive.
- Right-click it and choose Open with > Google Docs.
- Choose File > Download > Plain text (.txt) (Google Docs Help); plain text is one of Google's export formats.
Google runs OCR during the conversion, within limits: 2 MB or smaller, text at least 10 pixels high, pages right-side up, common fonts such as Arial. Bold and line breaks are likely to survive, but "lists, tables, columns, footnotes, and endnotes are not likely to be detected" (Google Drive Help).
How do I make a PDF searchable?
Run OCR and save the result as a PDF. OCR reads each page image and writes the words into an invisible text layer behind it, so the page looks the same but search and copy now work. Free options are ocrmypdf and Adobe's online OCR tool; in Acrobat desktop it's Scan & OCR.
Acrobat desktop. Open the scan and select All tools > Scan & OCR, then In this file > Recognize text, for what Adobe calls a searchable, editable PDF (Adobe Experience League).
Adobe's online OCR tool. Adobe's free OCR page OCRs a dropped PDF automatically; you sign in to download it, and Adobe says the file is deleted unless you sign in to save it.
ocrmypdf (free, command line). It adds an OCR text layer to scanned PDFs, "allowing them to be searched" (OCRmyPDF docs). Install it with brew install ocrmypdf on macOS or apt install ocrmypdf on Debian, Ubuntu or Windows Subsystem for Linux (install docs):
# Add a searchable text layer
ocrmypdf scan.pdf searchable.pdf
# Same, and also write the recognized text to a .txt file
ocrmypdf --sidecar scan.txt scan.pdf searchable.pdf
# A document in English and French
ocrmypdf -l eng+fra bilingual.pdf bilingual-searchable.pdf
Commands are from the OCRmyPDF cookbook; each language needs its pack installed. On a file that already has text, ocrmypdf stops with an error; --skip-text passes those pages through, --redo-ocr replaces an old OCR layer and --force-ocr rasterizes everything, at some cost to quality (OCRmyPDF error docs). The sidecar skips pages that already had text, so run pdftotext on the output PDF for all of it.
In testing, ocrmypdf 17.13.0 turned the image-only invoice into a PDF that pdftotext -layout read in full, table rows intact. That was a clean 300 DPI render; expect worse from a phone photo of a crumpled receipt.
How do I convert PDF to text on the command line?
Install Poppler and run pdftotext file.pdf, which writes file.txt next to the original in UTF-8. Add -layout to keep columns and table rows lined up, -f and -l for a page range, and - as the output name to print to the terminal. Scans need OCR first.
Get it with brew install poppler on macOS (Homebrew) or sudo apt install poppler-utils on Debian and Ubuntu (pdftotext man page).
pdftotext report.pdf # writes report.txt
pdftotext -layout invoice.pdf # keeps columns and table rows lined up
pdftotext -f 2 -l 5 report.pdf # pages 2 to 5 only
pdftotext report.pdf - | less # print instead of saving
# Every PDF in the current folder
for f in *.pdf; do pdftotext -layout "$f"; done
The man page also lists -raw, but says "use of raw mode is no longer recommended."
How do I extract text from a PDF with Python?
Install pypdf with pip install pypdf (Python 3.9 or later, per its installation guide), open the file with PdfReader and call extract_text() on each page. Its docs say plainly that "pypdf is not OCR software", so scans need OCR first.
from pypdf import PdfReader
reader = PdfReader("document.pdf")
text = "\n".join(page.extract_text() for page in reader.pages)
with open("document.txt", "w", encoding="utf-8") as f:
f.write(text)
For tables and side-by-side blocks, pass extraction_mode="layout", a fixed-width format that "closely adheres to the rendered layout" (pypdf docs). On scans the docs warn the result "may be minimal or visually empty", and the image-only test file gave an empty string.
Why does PDF text come out jumbled?
A PDF stores where each character sits on the page, not which sentence comes next, so extractors guess the reading order. That's why columns interleave, table rows split apart, ligatures turn into odd characters and line-end hyphens stay put; pypdf's docs call it a "missing semantic layer".
Test output below: pdftotext 24.02.0 and pypdf 6.21.2, run 23 Oct 2026 against small PDFs built for this post.
Tables split into columns. An invoice with a two-row line-item table, in default mode:
$ pdftotext invoice.pdf -
Invoice INV-1042
Bill to:
Sample Client LLC
12 Main St, Austin TX
Item
Pipe fitting
Labor (hours)
Ship to:
Sample Warehouse
88 Dock Rd, Austin TX
Qty
4
2
Price
12.50
85.00
...
Default mode went block by block, so "Pipe fitting" lands more than ten lines from its price. With -layout:
$ pdftotext -layout invoice.pdf -
Invoice INV-1042
Bill to: Ship to:
Sample Client LLC Sample Warehouse
12 Main St, Austin TX 88 Dock Rd, Austin TX
Item Qty Price Total
Pipe fitting 4 12.50 50.00
Labor (hours) 2 85.00 170.00
The rows are back together, and splitting each line on runs of two or more spaces (re.split(r"\s{2,}", line.strip())) gave clean cells on this file. For tables that span pages or have no ruling lines, the ASHDOCS PDF to Table API returns CSV and, with merge_tables set to true, merges multi-page tables, ruled or borderless, for 2 credits.
Two columns of prose. The result flips. Default pdftotext read the left column, then the right, while -layout printed them side by side and pypdf's default mode interleaved them:
Column one starts here and
Column two is a separate
keeps going on the left side
story that belongs after the
Default mode for articles and papers, then, and -layout for invoices, statements and forms.
Hyphenated line breaks. Default pdftotext rejoined "speci-" and "fied"; -layout and pypdf didn't. re.sub(r"(\w)-\n(\w)", r"\1\2", text) repairs it, though it also turns a line-broken "well-known" into "wellknown".
Ligatures. Both tools returned "fi" as one character (fi, U+FB01) on the test file, so a search for "office" missed "office". unicodedata.normalize("NFKC", text) swapped in plain letters (Python docs), but it also turns "m²" into "m2".
Missing spaces. pypdf's docs admit PDFs make it "very hard to guarantee correct whitespaces"; if words run together, try the other tool.
See how your own messy PDF comes out of an API. A test key runs the ASHDOCS PDF to Text API on your real file for no credits, and a live call costs 1.
How do I get PDF text inside Zapier, Make or n8n?
Send the file to an API from an HTTP step. The ASHDOCS PDF to Text API reads the text layer for 1 credit; the ASHDOCS OCR API handles scans and images for 3. Both take a multipart POST with an X-API-Key header, so any step that can upload a file over HTTP can call them.
# PDF with a text layer
curl -X POST https://www.ashdocs.com/api/v1/tools/pdf-to-text \
-H "X-API-Key: ash_test_..." \
-F "files=@document.pdf"
# Scan or photo: OCR it
curl -X POST https://www.ashdocs.com/api/v1/tools/ocr \
-H "X-API-Key: ash_test_..." \
-F "files=@scanned.pdf" \
-F 'options={"language":"eng"}'
Each call returns a JSON job; the result is a file at the signed link output_files[0].url, not inline text.
The ASHDOCS OCR API runs OCRmyPDF with Tesseract: the route above, with nothing to install. It reads 17 languages from PDF, JPG, PNG or TIFF and returns a searchable PDF by default; set output.text_sidecar to true to also get the text as a .txt file.
- Make: use the HTTP app's Make a request module, set the body content type to multipart/form-data and map the file from the previous module (Make docs). There's no ASHDOCS Make app yet.
- n8n: the ASHDOCS node (
n8n-nodes-ashdocs, verification pending) has no PDF to Text or OCR operation; use the core HTTP Request node with a Form-Data body and an n8n Binary File parameter (n8n docs). - Zapier: the ASHDOCS app (public beta) has no such action either, so use a Webhooks by Zapier POST step, which Zapier offers on paid plans, not Free (Zapier webhooks guide).
Live calls cost credits (pricing); ash_test_ keys never expire and run the full pipeline free, within plan rate limits. Files are kept 24 hours by default, or purged within minutes of the job finishing with options.retention set to "zero".
Text headed for an LLM? See PDF to Markdown for RAG. For named fields such as invoice number and total, read how to extract data from a PDF.
Frequently asked questions
Can I convert a PDF to a TXT file for free?
Yes. Copy and paste works in free viewers such as Acrobat Reader and Mac Preview, Google Docs can download a PDF as plain text, and pdftotext and pypdf are free, open-source tools. Only the Google Docs route also reads scanned pages.
Why can't I copy text from my PDF?
Usually it's a scan: each page is an image with no text layer to select. Less often, security settings or a password block copying. For a scan, run OCR with Google Drive, Adobe's online OCR tool or ocrmypdf first, then copy the text out.
How do I convert a scanned PDF to text?
Run OCR on it. Open it in Google Docs from Google Drive (files up to 2 MB), use Adobe's free online OCR tool, or run ocrmypdf with --sidecar to get a .txt file next to a searchable PDF. In Acrobat desktop, use Scan & OCR, then Recognize text.
Does converting a PDF to TXT keep tables and formatting?
No. A TXT file holds characters only, so fonts, colors, bold text and images are dropped. Table rows can survive as aligned text with pdftotext -layout; for real cells, use a PDF to table tool that outputs CSV.
Is it safe to upload a PDF to an online converter?
It depends on the service's retention policy, so read it first. Adobe says its online OCR tool deletes files unless you sign in to save them; ASHDOCS keeps files 24 hours by default, or purges them within minutes with zero retention on. Local tools such as pdftotext and ocrmypdf never upload anything.
Get PDF text inside your Zaps, Make scenarios and n8n workflows: create a free ASHDOCS account, copy your test key, and send your first file to the PDF to Text API without spending a credit.