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 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
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
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 ...
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.
🌐
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.
Find elsewhere
🌐
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.
🌐
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.
🌐
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.
🌐
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.
🌐
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
Firecrawl can parse and output content from web hosted pdfs, docx, and more. ... Smart wait. Firecrawl intelligently waits for content to load, making scraping faster and more reliable. ... Cached, when you need it. Selective caching, you choose your caching patterns, growing web index. ... Enhanced mode. Reaches every corner of the web with comprehensive coverage and high reliability. ... Actions. Click, scroll, write, wait, press and more before extracting content.
🌐
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…
🌐
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.
🌐
DEV Community
dev.to › rishabdugar › pdf-extraction-retrieving-text-and-tables-together-using-python-14c2
PDF Extraction: Retrieving Text and Tables together using Python🐍 - DEV Community
September 22, 2024 - This approach provides a systematic way to extract and combine text and tables from PDFs using “pdfplumber”. By leveraging table and text line positional values, we can maintain the integrity of the original document’s layout.
🌐
OCR.space
ocr.space
Free OCR API V2026, Online OCR, Searchable PDF Creator and OCR Software
The OCR.space Online OCR service converts images and PDF documents into editable text files using Optical Character Recognition (OCR).
🌐
Medium
medium.com › @andrewwil › extract-text-and-images-from-pdf-with-python-320fec8b9d35
Extract Text and Images from PDF with Python | by Andrew Wilson | Medium
December 28, 2023 - Spire.PDF for Python provides the PdfPageBase.ExtractText() method to extract text from a PDF page.
🌐
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.
🌐
DEV Community
dev.to › seraph776 › extract-text-from-pdf-using-python-5flh
Extract Text from PDF Using Python - DEV Community
July 24, 2022 - Read the Official Python Documentation to learn more about encoding · import PyPDF2 # STEP 1: open PDF and convert to text def extract_text_from_pdf(pdf_filename: str) -> str: text_output = '' with open(pdf_filename, 'rb') as pdf_object: pdf_reader ...