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. Answer from ImGallo on reddit.com
🌐
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!

🌐
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

How to extract text from a PDF file via python? - Stack Overflow
I'm extracting this PDF's text using the PyPDF2 Python package (version 1.27.2): import PyPDF2 with open("sample.pdf", "rb") as pdf_file: read_pdf = PyPDF2.PdfFileReader(pd... More on stackoverflow.com
🌐 stackoverflow.com
How To Extract Text From PDFs Using Python?
If you’re new to Python and need to extract text from PDFs, start with 'PyPDF2'. It’s beginner-friendly and gets the job done for basic tasks. Install it, load your PDF, and use 'PdfReader' to access the text. Here’s a tip: wrap it in a 'try-except' block to handle errors like missing ... More on goodnovel.com
🌐 goodnovel.com
3
June 3, 2025
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
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
People also ask

How can I extract specific text from a PDF using Python?
You can use IronPDF's Python library to extract text from PDFs. It provides functionalities to extract text page-by-page using ExtractTextFromPage or from the entire document using ExtractAllText.
🌐
ironpdf.com
ironpdf.com › ironpdf for python › ironpdf for python blog › using ironpdf for python › extract specific text from pdf python
Extract Specific Text From PDF in Python (Tutorial) | IronPDF for ...
What are some key features of the IronPDF library for Python?
IronPDF for Python offers features such as creating PDFs from HTML, converting images to PDFs, form handling, text and image extraction, and PDF merging.
🌐
ironpdf.com
ironpdf.com › ironpdf for python › ironpdf for python blog › using ironpdf for python › extract specific text from pdf python
Extract Specific Text From PDF in Python (Tutorial) | IronPDF for ...
How can I install IronPDF for Python?
Install IronPDF using the pip package manager by running the command pip install ironpdf in your terminal or command prompt.
🌐
ironpdf.com
ironpdf.com › ironpdf for python › ironpdf for python blog › using ironpdf for python › extract specific text from pdf python
Extract Specific Text From PDF in Python (Tutorial) | IronPDF for ...
🌐
PyPDF
pypdf.readthedocs.io › en › latest › user › extract-text.html
Extract Text from a PDF — pypdf 6.10.2 documentation
If a PDF page appears to contain only an image (e.g., a scanned document), the extracted text may be minimal or visually empty. In such cases, consider using OCR software such as Tesseract OCR to extract text from images.
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)
🌐
W3Schools
w3schools.in › python › examples › extracting-text-from-pdf-files-using-python
Extracting Text from PDF Files Using Python
Learn how to extract text from PDF files using Python. We'll guide you through using the PyPDF2 library and help you create a straightforward Python program to extract texts from PDFs.
Find elsewhere
🌐
Medium
medium.com › @tam.tamanna18 › pdf-to-text-extraction-42e1da56c4d1
PDF-to-text extraction. PDF-to-text extraction is a fundamental… | by Tamanna | Medium
August 6, 2025 - PyPDF2: PyPDF2 is a simple and effective library for extracting text from PDF files. However, it has limitations with handling complex PDF structures and may not work optimally with all types of PDFs.
🌐
Apryse
apryse.com › blog › extract-text-from-pdf-python
How to Extract Text from a PDF Using Python | Apryse
December 9, 2022 - Run the following code sample for a very basic text extraction using a Python script with the Apryse SDK: ... Next, decide what to do with the extracted text. You can save it to another text file, or in a database. Execute the following code to specify where to send your extracted text. ... You can even use a utility method to extract all text content from a specific region, like a rectangle on a PDF page.
🌐
IronPDF
ironpdf.com › ironpdf for python › ironpdf for python blog › using ironpdf for python › extract specific text from pdf python
Extract Specific Text From PDF in Python (Tutorial) | IronPDF for Python
June 23, 2025 - By passing the page number as a parameter to the ExtractTextFromPage function, the text can be retrieved from a specific page. A string containing all the words on the chosen page will be returned by this method.
🌐
GoodNovel
goodnovel.com › qa › extract-text-pdfs-using-python
How To Extract Text From PDFs Using Python? - GoodNovel
June 3, 2025 - If you’re new to Python and need to extract text from PDFs, start with 'PyPDF2'. It’s beginner-friendly and gets the job done for basic tasks. Install it, load your PDF, and use 'PdfReader' to access the text.
🌐
Docling
docling.ai
Docling
from docling.document_converter import DocumentConverter source = "https://arxiv.org/pdf/2408.09869" converter = DocumentConverter() doc = converter.convert(source).document print(doc.export_to_markdown()) ... Import many document formats into a unified and structured Docling Document , including scanned pages via an OCR engine of your choice. Export a parsed document to formats that simplify processing and ingestion into AI, RAG, and agentic systems. Extract document components and their properties from the Docling Document.
🌐
Decade City
decadecity.net › blog › 2025 › 03 › 07 › extracting-text-from-pdfs-using-python-and-tesseract
Extracting text from PDFs using Python and Tesseract | Blog | Decade City
import sys from pathlib import Path from pdf2image import convert_from_path from pytesseract import image_to_string input_file = Path(sys.argv[1]) output = "" for page_number, page_data in enumerate(convert_from_path(input_file), start=1): txt = image_to_string(page_data) output += f"\n-- {page_number}\n{txt}\n" output_file = input_file.with_suffix(".txt") output_file.write_text(output) This can extract tens of pages in a few seconds of CPU time on a five year old laptop which is good enough™ for me, I don't need an AI assistant to do it.
🌐
The Python Code
thepythoncode.com › article › extract-text-from-pdf-in-python
How to Extract Text from PDF in Python - The Python Code
Learn how to extract text as paragraphs line by line from PDF documents with the help of PyMuPDF library in Python.
🌐
Readthedocs
pypdf2.readthedocs.io › en › 3.x › user › extract-text.html
Extract Text from a PDF — PyPDF2 documentation
You might now wonder if it makes sense to just always use OCR software. If the PDF file is digitally-born, you can just render it to an image. I would recommend not to do that. Text extraction software like PyPDF2 can use more information from the PDF than just the image.
🌐
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.
🌐
Medium
medium.com › analytics-vidhya › how-to-easily-extract-text-from-any-pdf-with-python-fc6efd1dedbe
How To Easily Extract Text From Any PDF With Python | by Vinicius Porfirio Purgato | Analytics Vidhya | Medium
January 18, 2024 - Imagine you have lots of files that follow the same pattern of text, you could make a ``for loop`` and then Python would iterate over all of them and return the profit value of each one. sum = 0 #make a counter#making the functionfor reports in week_files: report = pdfplumber.open(reports) page = report.pages[0] text = page.extract_text() #extracting the text value = text.split("\n")[6].replace("\t", "").split("R$")[1] value = float(value) sum += valueprint("{} ----> {}".format(reports, value))
🌐
GeeksforGeeks
geeksforgeeks.org › python › working-with-pdf-files-in-python
Working with PDF files in Python - GeeksforGeeks
June 21, 2025 - PDF reader object has function pages[] which takes page number (starting from index 0) as argument and returns the page object. ... Page object has function extract_text() to extract text from the PDF page.
🌐
Firecrawl
firecrawl.dev
Firecrawl - Search, Scrape, and Interact with the Web for AI
Media parsing. Firecrawl can parse and output content from web hosted pdfs, docx, and more. ... Smart wait. Firecrawl intelligently waits for content to load, making data extraction faster and more reliable.
🌐
Better Programming
betterprogramming.pub › how-to-convert-pdfs-into-searchable-key-words-with-python-85aab86c544f
How to Extract Words From PDFs With Python | by Rizwan Qaiser | Better Programming
March 20, 2020 - What follows is a tutorial on how you can parse through a PDF file and convert it into a list of keywords. For this tutorial, I’ll be using Python 3.6.3. You can use any version you like (as long as it supports the relevant libraries). You will require the following Python libraries in order to follow this tutorial: PyPDF2 (to convert simple, text-based PDF files…
🌐
The Data School
thedataschool.co.uk › salome-grasland › converting-a-pdf-to-text-file-using-python
Extracting Text from PDFs with Python - The Data School
The extract_text() method is called on each page to extract the text, which is then appended to the text variable. Finally, the function returns the accumulated text extracted from all the pages.
🌐
PDF.co
pdf.co › tutorials › extract-text-from-scanned-pdf-in-python
How to Extract Text from Scanned PDF in Python using PDF.co Web API | PDF.co
In this detailed tutorial, learn how you can easily extract text from scanned PDF using PDF.co Web API in Python.