Just the text
Sometimes you don’t need a PDF’s formatting or layout. You just need the words.
Maybe you want to search a document, copy some text into another application, extract content for a script, or see what is actually stored inside a PDF.
This converter extracts the text in reading order and gives you plain text that you can copy or download.
For text-based PDFs, the conversion happens in your browser, so the file doesn’t need to be uploaded.
How text extraction from a PDF works
Most PDFs created digitally — for example, from Word, a web browser or design software — contain a text layer.
That layer contains the characters on the page and information about where they are positioned.
Extracting the text means taking those individual pieces and reconstructing them into words, lines and paragraphs.
The tricky part is that a PDF doesn’t necessarily know what a word or sentence is.
It might know that an S is at one position and a t is a few pixels to the right. It doesn’t necessarily store “St” as a word.
That’s why two PDF-to-text tools can give you very different results from exactly the same document.
Why spacing can go wrong
Some PDFs position characters individually rather than storing complete words. This is common in documents produced by certain email systems, design software and PDF generators.
A simple extractor can interpret the gaps between those characters as spaces and produce something like:
F rom M ichae l C o ffi ll
instead of:
From Michael Coffill
The converter looks at the distance between characters when rebuilding words.
Characters that are close together are treated as part of the same word, while larger gaps are treated as word boundaries. The distances are considered relative to the text’s size, rather than simply inserting a space whenever two characters aren’t touching.
It’s a small detail, but it matters when you’re extracting a document you actually intend to use.
Reading order matters too
PDF text isn’t always stored in the same order that you read it.
A document might have two columns:
Column 1 Column 2
First paragraph Another paragraph
More text More text
but the underlying PDF can store those pieces in a different sequence.
The extractor uses the position of the text on the page to reconstruct a sensible reading order, generally working from top to bottom and left to right.
This works well for ordinary documents. More complicated layouts — particularly documents with sidebars, footnotes or several independent text areas — can still require some cleanup.
If you need the original positions of the text rather than just the words, PDF to JSON is a better choice.
Extract PDF text in code
If you’re processing a PDF manually, the browser converter is the quickest option.
For an application or document pipeline, you can use the API:
curl -X POST https://api.pdftojson.dev/v1/extract \
-H "Authorization: Bearer $KEY" \
-F file=@document.pdf -F format=text
import requests
response = requests.post(
"https://api.pdftojson.dev/v1/extract",
headers={"Authorization": f"Bearer {KEY}"},
files={"file": open("document.pdf", "rb")},
data={"format": "text"},
)
text = response.json()["content"]
const form = new FormData();
form.append("file", fs.createReadStream("document.pdf"));
form.append("format", "text");
const { content } = await fetch("https://api.pdftojson.dev/v1/extract", {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: form,
}).then((r) => r.json());
The API is useful when you need to process files automatically, handle scanned documents, or add PDF extraction to your own application.
What about scanned PDFs?
A scanned PDF is usually an image of a document rather than a document containing actual text.
That’s why you can’t normally select or copy text from a scanned PDF. There is no text layer underneath the image.
To extract text from a scan, you need OCR (optical character recognition). OCR analyses the page image and identifies the characters it contains.
The browser converter works with PDFs that already contain a text layer. Scanned PDFs can be processed through the API using OCR.
Other PDF text extraction problems
Most ordinary PDFs extract cleanly, but there are a few less common cases that can cause problems.
Ligatures
Some fonts represent combinations such as fi or fl as a single character. Depending on the PDF’s font encoding, these can occasionally come out incorrectly during extraction.
Custom font encodings
A PDF can use its own character mapping rather than standard character codes. If that mapping isn’t interpreted correctly, you can end up with incorrect or unreadable characters.
Multiple columns
As mentioned above, columns, sidebars and footnotes can make reading order ambiguous. Position-based extraction helps, but unusual layouts can still need manual cleanup.
Duplicated text
Some scanned PDFs contain an invisible OCR text layer underneath the page image. If that layer is poorly constructed, extraction can sometimes produce duplicate or unexpected text.
These problems aren’t typical of everyday PDFs, but they’re worth knowing about if one particular document produces strange results.
PDF to text vs other tools
There are plenty of ways to extract text from a PDF. Here are some of the common ones.
Copy and paste
For a paragraph or two, copying directly from a PDF viewer is perfectly fine. With longer documents, you can run into problems with line breaks, columns, character spacing and reading order.
pdftotext
pdftotext, part of the Poppler project, is a well-established command-line PDF text extractor. It’s fast and useful for batch processing if you’re comfortable working from a terminal.
pypdf and PyMuPDF
Both are popular Python libraries for working with PDFs. They’re good choices when you’re already building a Python application and want to control the extraction yourself.
Chatbots
A chatbot can extract or summarise a PDF as part of a larger task, but if all you want is the text, a dedicated extractor is simpler. It also gives you a repeatable output that you can feed into your own tools.
The browser converter is intended for the simple case: give it a text-based PDF and get the text back without installing anything. For scanned documents and automated processing, the API adds OCR and programmatic access.
Is PDF to text private?
Text-based PDFs are parsed in your browser, so the file doesn’t need to be uploaded.
OCR for scanned PDFs is performed through the API, which requires the file to be sent for processing. API files are handled according to the service’s current data-retention policy.