Guide
How to extract text from any PDF, including scanned documents
Extracting text from a PDF should be simple, but it often is not. Whether you are dealing with a text-based PDF where copy-paste produces garbled results, or a scanned document where text is trapped inside images, here are reliable solutions.
Why extracting text from PDFs can be difficult
PDFs come in two fundamentally different varieties. Text-based PDFs contain actual character data with font and positioning information. These are created by applications like Word, Pages, or InDesign. Image-based PDFs contain scanned images of documents with no actual text data. These come from scanners, cameras, and some fax machines.
Even with text-based PDFs, copying and pasting can produce unexpected results. Some PDFs use custom character encodings that map display characters to different Unicode values, so copying produces gibberish. Others store text in reading order that does not match the visual layout, causing columns to merge or text to appear jumbled.
Multi-column layouts, tables, headers and footers, and footnotes all create additional challenges for text extraction. A simple copy-paste often interleaves text from different columns or mixes body text with header content.
Method 1: Copy and paste (for simple text PDFs)
Open the PDF in Preview or any PDF viewer, select the text with your cursor, and paste it into your target application. This works well for single-column, text-based PDFs without complex formatting.
If the pasted text has extra line breaks, missing spaces, or garbled characters, the PDF's internal text encoding may be non-standard. In that case, using a dedicated extraction tool will produce better results.
Method 2: Use built-in Mac tools for longer or scanned documents
For many pages at once, macOS Automator includes an Extract PDF Text action that saves a PDF's text as a plain text or RTF file. Microsoft Word and Google Docs can also open a PDF and convert it into an editable document, with varying success on complex layouts.
For scanned PDFs, recent versions of macOS include Live Text, which recognizes text in images entirely on your device. Open the scanned page in Preview, hover over the text, and select it like normal text. File Studio does not perform OCR or extract text itself, but its PDF to Images tool can turn each scanned page into a high-resolution PNG (up to 216 DPI) that Live Text reads easily.
File Studio can also help you narrow the job down first: use Split to pull out only the pages you need, or Extract Images to save the embedded scans as separate files, all locally on your Mac.
Getting the best results from text extraction
For text-based PDFs, extracting to plain text (.txt) gives the cleanest output with no formatting artifacts. If you need to preserve structure, export to RTF or open the PDF in a word processor.
For scanned documents, the quality of the scan directly affects OCR accuracy. Clean, high-resolution scans (300 DPI or above) with good contrast produce the best results. Skewed pages, low resolution, and poor contrast all reduce accuracy. Exporting pages as images at a higher DPI, and rotating sideways pages upright first, can improve results.
How text is stored in PDFs and why extraction varies
PDFs store text in two fundamentally different ways: as vector text (selectable characters with font information) and as raster images of text (scanned pages). Vector text can be extracted directly by reading the content stream, which contains the actual character codes and their positions. This is how text ends up in a PDF when you export from Word, save from a browser, or create a PDF from any application.
Scanned documents, by contrast, contain no text data at all. Each page is a photograph of the physical page, and what appears to be text is actually an array of pixels. Extracting text from scanned PDFs requires Optical Character Recognition (OCR), which analyzes the image to identify letter shapes and convert them to actual characters. OCR accuracy depends on scan quality, font clarity, and language complexity.
Some PDFs are hybrids: they contain scanned page images with an invisible text layer generated by OCR during the scanning process. This invisible text enables searching and copying while the visible image provides the faithful visual reproduction. When extracting text from such PDFs, you can pull from the hidden text layer without running OCR again, though the accuracy depends on the quality of the original OCR pass.
OCR accuracy and how to improve it
Modern OCR engines (based on machine learning and neural networks) achieve 95-99% accuracy on clean, well-scanned documents with standard fonts. Accuracy drops with poor scan quality, skewed pages, unusual fonts, handwritten text, low contrast, and complex layouts with multiple columns or tables.
To maximize OCR accuracy, scan at 300 DPI or higher in grayscale or black-and-white mode. Color scanning is unnecessary for text documents and increases file size without improving recognition. Ensure pages are straight (not skewed), clean (no coffee stains or fold marks), and well-lit (no shadows from book spines).
For documents with tables, OCR often extracts the text but loses the tabular structure. The resulting text reads across rows but the column alignment is gone. Dedicated table extraction tools (such as Tabula, or Excel's Get Data from PDF feature) attempt to preserve the grid structure, outputting values that you can work with in a spreadsheet.
Text extraction output formats and use cases
Plain text extraction strips all formatting and produces a simple text file. This is useful for indexing, searching, or feeding content into other applications. However, you lose all layout information: headings, bullet points, columns, and paragraphs are flattened into a continuous stream of text.
Rich text extraction preserves some formatting (bold, italic, font sizes, paragraph breaks) and produces output compatible with word processors. This is more useful when you need to repurpose the content while maintaining its structure, but it requires the PDF to contain explicit font style information.
For data extraction from structured PDFs (invoices, forms, reports with consistent layouts), the most effective approach is template-based extraction where you define regions of interest on the page. Several dedicated data extraction tools support region selection, allowing you to draw a box around the data you need and extract only that area, which is far more practical than extracting the entire page and manually finding the relevant information.
Pro tips
- *Before running OCR on a scanned PDF, check whether it already has a hidden text layer. Try selecting text with your cursor in Preview or Acrobat Reader. If text highlights, OCR has already been applied and you can copy directly.
- *For scanned documents with poor OCR accuracy, try preprocessing the scan: increase contrast, convert to grayscale, and deskew the pages before running OCR. These steps can significantly improve character recognition.
- *When extracting text from a PDF with columns (like a newspaper or academic paper), use a tool that supports column-aware extraction. Otherwise, text from adjacent columns gets interleaved, producing nonsensical output.
- *For extracting tabular data, copy the text into a spreadsheet application and use text-to-columns functionality rather than trying to paste directly. The tab and space characters from PDF extraction rarely align with spreadsheet column boundaries.
- *If you need text from a specific page range rather than the entire document, pull those pages out with File Studio's Split tool first, so your extraction or OCR tool processes only what you need.
How to do it with File Studio
Check whether the PDF has real text
Open the PDF in Preview and try to select a sentence. If you can highlight individual words, it is text-based. If the whole page selects as one picture, it is a scan.
Extract text-based PDFs directly
Copy and paste for short passages, or use Automator's Extract PDF Text action to save the whole document as plain text or RTF.
Use Live Text for scanned pages
If the pages are scans, use File Studio's PDF to Images tool to export them as high-resolution PNGs, then open them in Preview or Photos and select the text with Live Text. Review the output for accuracy.
Try File Studio free
All tools work 100% offline. No sign-ups, no uploads, no subscriptions. Download and start converting right away.
FAQ
Frequently asked questions
Why does copy-paste from a PDF produce garbled text?→
Some PDFs use custom character encodings or font subsets that do not map cleanly to Unicode. The text looks correct on screen because the font displays the right glyphs, but the underlying character codes do not match standard text encoding. A dedicated extraction tool resolves this by interpreting the PDF's encoding table correctly.
Can I extract text from a scanned PDF?→
Yes, using OCR (optical character recognition). On a Mac, Live Text in Preview and Photos recognizes text in images on your device, so your scanned documents remain private. File Studio does not include OCR, but it can export scanned pages as high-resolution images for Live Text to read.
How accurate is OCR for scanned documents?→
Modern OCR engines achieve 99%+ accuracy on clean, high-resolution scans in common languages. Accuracy decreases with poor scan quality, unusual fonts, handwriting, or low contrast. Always review OCR output for critical documents.
Can I extract text from specific pages only?→
Yes. Use File Studio's Split tool to pull out just the pages you need (for example 3-7) as a new PDF, then copy or extract the text from that smaller file.
Will the extracted text preserve formatting like bold and headings?→
If you extract to plain text, formatting is lost. Exporting to RTF or opening the PDF in a word processor can keep some headings, bold, italic, and basic layout structure. Table extraction accuracy depends on the complexity of the table layout.
@ayysoni · March 2, 2026
Related File Studio tools:
More guides: