I was looking for a simple solution to use for python 3.x and windows. There doesn't seem to be support from textract, which is unfortunate, but if you are looking for a simple solution for windows/python 3 checkout the tika package, really straight forward for reading pdfs.

Tika-Python is a Python binding to the Apache Tika REST services allowing Tika to be called natively in the Python community.

from tika import parser # pip install tika

raw = parser.from_file('sample.pdf')
print(raw['content'])

Note that Tika is written in Java so you will need a Java runtime installed.

Answer from DJK on Stack Overflow
Top answer
1 of 16
323

I was looking for a simple solution to use for python 3.x and windows. There doesn't seem to be support from textract, which is unfortunate, but if you are looking for a simple solution for windows/python 3 checkout the tika package, really straight forward for reading pdfs.

Tika-Python is a Python binding to the Apache Tika REST services allowing Tika to be called natively in the Python community.

from tika import parser # pip install tika

raw = parser.from_file('sample.pdf')
print(raw['content'])

Note that Tika is written in Java so you will need a Java runtime installed.

2 of 16
244

pypdf recently improved a lot. Depending on the data, it is on-par or better than pdfminer.six.

pymupdf / tika / PDFium are better than pypdf, but the difference became rather small - (mostly when to set a new line). The core part is that they are way faster. But they are not pure-Python which can mean that you cannot execute it. And some might have too restrictive licenses so that you may not use it.

Have a look at the benchmark. This benchmark mainly considers English texts, but also German ones. It does not include:

  • Anything special regarding tables (just that the text is there, not about the formatting)
  • Arabic test (RTL-languages)
  • Mathematical formulas.

That means if your use-case requires those points, you might perceive the quality differently.

Having said that, the results from November 2022:

pypdf

I became the maintainer of pypdf and PyPDF2 in 2022! The community improved the text extraction a lot in 2022. Give it a try :-)

First, install it:

pip install pypdf

And then use it:

from pypdf import PdfReader

reader = PdfReader("example.pdf")
text = ""
for page in reader.pages:
    text += page.extract_text() + "\n"

Please note that those packages are not maintained:

  • PyPDF2, PyPDF3, PyPDF4
  • pdfminer (without .six)

pymupdf

import fitz # install using: pip install PyMuPDF

with fitz.open("my.pdf") as doc:
    text = ""
    for page in doc:
        text += page.get_text()

print(text)

Other PDF libraries

  • pikepdf does not support text extraction (source)
🌐
GeeksforGeeks
geeksforgeeks.org › python › extract-text-from-pdf-file-using-python
Extract text from PDF File using Python - GeeksforGeeks
July 12, 2025 - Python package pypdf can be used to achieve what we want (text extraction), although it can do more than what we need. This package can also be used to generate, decrypting and merging PDF files.
Discussions

What’s the Best Python Library for Extracting Text from PDFs?
In my experience, PyMuPDF is the best open-source Python library for this, better than PDFplumber, PyPDF2, and others. For paid options, Azure Document Intelligence is excellent; it can even handle unstructured tables. More on reddit.com
🌐 r/LangChain
85
81
July 19, 2024
PDF Extraction with python wrappers
Hi everyone, I need some advices. Some people recommend me to use python wrappers (poppler pdfto text) to extract data from this PDF file, from page 4 to end or known limit (here: page 605). But I never used poppler pdfto text before and need some help, please. More on discuss.python.org
🌐 discuss.python.org
19
0
December 5, 2023
Extract text from PDF
Hey, I’ve spent quite a bit of time looking at extracting text as accurately as possibly from PDFs, it’s turns out that it is not as simple as it might seem. It is especially tricky once you get a wide variety of PDFs (including PDFs with image based text or tables). While I unfortunately cannot share the code I used to extract this text, I will tell you that for what I think your doing, the best solution will require a few things. First you should pick a good module. I’ve spent a long time going over open source solutions to this and the best two I’d say are Excalibur and Apache Tika . Unfortunately, there is no one Python module that is going to extract PDF text 100% of the time correctly. This is because once you start to work with a wide variety PDFs that aren’t as straight forward as just text in a document, you introduce a scholastic element to the problem. This means you have to bring in more complicated OCR or ML approaches that are far from 99 or 100% accurate. Feel free to PM me if you have any more questions! More on reddit.com
🌐 r/Python
42
87
November 2, 2021
Best Way to Extract Text from a PDF
pdfplumber has yielded the best results in my testing. You can modify the default table extraction settings to extract "columns" (assuming the default doesn't already detect them). https://github.com/jsvine/pdfplumber#table-extraction-methods You can also check of they are detected by .rects The Visual Debugging can be helpful in actually seeing what the settings currently matching. https://github.com/jsvine/pdfplumber#visual-debugging There are also several threads in the github discussions showing examples of customized settings which may be useful to read through. https://github.com/jsvine/pdfplumber/discussions More on reddit.com
🌐 r/learnpython
7
5
January 9, 2023
🌐
PyPDF
pypdf.readthedocs.io › en › stable › user › extract-text.html
Extract Text from a PDF — pypdf 6.9.2 documentation
That typically happens when a document was scanned. Although the scanning software (OCR) is pretty good today, it still fails once in a while. pypdf is no OCR software; it will not be able to detect those failures. pypdf will also never be able to extract text from images.
🌐
Medium
onlyoneaman.medium.com › i-tested-7-python-pdf-extractors-so-you-dont-have-to-2025-edition-c88013922257
I Tested 7 Python PDF Extractors So You Don’t Have To (2025 Edition) | by Aman Kumar | Medium
July 21, 2025 - What I got: Clean, readable text in 0.004 seconds. No formatting, no table structure — just fast, basic extraction. Good for: High-volume processing, simple content indexing, when speed matters more than structure. Consider if you need any formatting preservation or structured data extraction. # pip install pypdf from pypdf import PdfReader reader = PdfReader("doc.pdf") text = "\n".join(p.extract_text() for p in reader.pages)
🌐
Nutrient
nutrient.io › blog › sdk › extract text from pdf using python
Parse PDFs with Python: Step-by-step text extraction tutorial
June 4, 2025 - Parsing PDFs in Python is easy with the right tools. This tutorial walks you through extracting text from PDFs using PyPDF(opens in a new tab) for basic, selectable text, and the Nutrient Processor API for more advanced use cases like OCR, encrypted documents, and structured JSON output.
🌐
Reddit
reddit.com › r/langchain › what’s the best python library for extracting text from pdfs?
r/LangChain on Reddit: What’s the Best Python Library for Extracting Text from PDFs?
July 19, 2024 -

Hello everyone, I hope you're all doing well! I’m currently on the lookout for a library that can extract text in paragraph chunks from PDFs. For instance, I need it to pull out the Introduction with all its paragraphs separately, the Conclusion with all its paragraphs separately, and so on, essentially chunking the text by paragraphs. Do you have any suggestions? Thanks!

🌐
freeCodeCamp
freecodecamp.org › news › extract-data-from-pdf-files-with-python
How to Extract Data from PDF Files with Python
March 6, 2023 - Data extraction from PDF files is a crucial task because these files are frequently used for document storage and sharing. Python's PDFQuery is a potent tool for extracting data from PDF files.
Find elsewhere
🌐
Readthedocs
pypdf2.readthedocs.io › en › 3.0.0 › user › extract-text.html
Extract Text from a PDF — PyPDF2 documentation
If you scan a document, the resulting PDF typically shows the image of the scan. Scanners then also run OCR software and put the recognized text in the background of the image. This result of the scanners OCR software can be extracted by PyPDF2. However, in such cases it’s recommended to directly use OCR software as errors can accumulate: The OCR software is not perfect in recognizing the text.
🌐
Nanonets
nanonets.com › blog › extract-text-from-pdf-file-using-python
Tutorial: How to extract text from PDF using Python?
July 11, 2025 - You can use any text editor or IDE to write Python code, such as Visual Studio Code, PyCharm, or Sublime Text. We will use the PyPDF2 Python library to extract files. ... Below is the code to extract the data from PDF using PyPDF2 library. # importing required modules from PyPDF2 import PdfReader # creating a pdf reader object reader = PdfReader('nanonet.pdf') # printing number of pages in pdf file print(len(reader.pages)) # getting a specific page from the pdf file page = reader.pages[0] # extracting text from page text = page.extract_text() print(text)
🌐
Towards Data Science
towardsdatascience.com › home › latest › extracting text from pdf files with python: a comprehensive guide
Extracting text from PDF files with Python: A comprehensive guide | Towards Data Science
January 27, 2025 - Alternatively, you can run the following commands to directly include their paths in the Python script using the following code: pytesseract.pytesseract.tesseract_cmd = r'C:Program FilesTesseract-OCRtesseract.exe' ... Lastly, we will import all the libraries at the beginning of our script. # To read the PDF import PyPDF2 # To analyze the PDF layout and extract text from pdfminer.high_level import extract_pages, extract_text from pdfminer.layout import LTTextContainer, LTChar, LTRect, LTFigure # To extract text from tables in PDF import pdfplumber # To extract the images from the PDFs from PIL import Image from pdf2image import convert_from_path # To perform OCR to extract text from images import pytesseract # To remove the additional created files import os
🌐
Unstructured
unstructured.io › blog › how-to-process-pdf-in-python
Process PDFs in Python: Step-by-Step Guide | Unstructured
Popular options include PyPDF2, pdfplumber, and pdfminer.six, each with different trade-offs in terms of accuracy, speed, and support for complex layouts. For straightforward text extraction from well-formatted PDFs, these libraries work reasonably ...
🌐
Apryse
apryse.com › blog › extract-text-from-pdf-python
How to Extract Text from a PDF Using Python | Apryse
December 9, 2022 - Use the Apryse SDK to run the bulk text extraction from your PDFs, automating the process. Use Python scripts to specify what information to extract, from where, and where to send the extracted data.
🌐
Medium
medium.com › @alice.yang_10652 › with-read-or-extract-text-from-pdf-with-python-a-comprehensive-guide-eb22c440e22a
Read or Extract Text from PDF with Python — A Comprehensive Guide | by Alice Yang | Sep, 2023 | Medium | Medium
July 8, 2024 - ... You can simply extract text from an entire PDF document by iterating through the pages in the document and then calling the PdfTextExtractor.ExtractText() function to extract text from every page of the PDF document.
🌐
IronPDF
ironpdf.com › ironpdf for python › blog › using ironpdf for python › python extract text from pdf
Python Extract Text From PDF (Developer Tutorial) | IronPDF for Python
January 19, 2026 - IronPDF provides Python programmers with the ability to manipulate, extract data from, and interact with PDF files using Python, making it easier to automate various PDF-related tasks.
🌐
PyPDF
pypdf.readthedocs.io › en › latest › user › extract-text.html
Extract Text from a PDF — pypdf 6.10.0 documentation
That typically happens when a document was scanned. Although the scanning software (OCR) is pretty good today, it still fails once in a while. pypdf is no OCR software; it will not be able to detect those failures. pypdf will also never be able to extract text from images.
🌐
Ploomber
ploomber.io › blog › pdf-ocr
Python OCR libraries for converting PDFs into editable text
March 27, 2024 - Tesseract is an open-source OCR Engine that extracts printed or written text from images. It was originally developed by Hewlett-Packard, and development was later taken over by Google. ... Community Support: Tesseract has a large and active community of developers and contributors who continuously work on improving the engine, fixing bugs, and adding new features. First, we need to install Tesseract. ... Next, we’ll first convert the PDF pages to PIL objects and then extract text from these objects using pytesseract’s image_to_string method:
🌐
IronPDF
ironpdf.com › ironpdf for python › ironpdf for python blog › using ironpdf for python › python extract text from pdf line by line
Python Extract Text From PDF Line By Line (Tutorial)
January 19, 2026 - Create a Python project in your preferred IDE. Load the desired PDF file for retrieving textual content. Loop through the PDF and extract text sequentially using the built-in library's function.
🌐
Scaler
scaler.com › home › topics › program to extract text from pdf in python
Program to Extract Text From PDF in Python - Scaler Topics
March 15, 2023 - In our example, the number of pages is equal to 1. Now we create a page object using the first page, by passing in the index ... Now we can extract the text from the page object using the function extractText(). In this way, we can extract text ...