Skip to main content

txt-from-pdf: Extract clean text from PDFs

Github release PyPI version GitHub license

Extracting text from pdfs using pymupdf, but with a focus on cleaning and formatting the extracted text.

Installation

pip install txt-from-pdf

Usage

from txtfrompdf import extract_txt_from_pdf

pdf_path = "file.pdf"
text = extract_txt_from_pdf(pdf_path)
print(text)

CLI Usage

Single file:

txt-from-pdf --input file.pdf --output extracted-text 

Multiple files in a directory:

txt-from-pdf --input dir-with-pdfs --output extracted-text 

Detailed help:

usage: txt-from-pdf [-h] --input INPUT [--output OUTPUT] [--no_filter] [--size SIZE]

txt-from-pdf CLI - Extracts cleaned text from PDF files

options:
  -h, --help       show this help message and exit
  --input INPUT    Path to a folder containing PDFs or to a single PDF file. (Required)
  --output OUTPUT  Output location for the extracted text files. (Optional, default: 'extracted_text')
  --no_filter      Turn off cleaning the resulting text files. (Optional)

Release files for txt-from-pdf 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txt-from-pdf 1.3.1
File Size Uploaded
txt-from-pdf-1.3.1.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for txt-from-pdf 1.3.1
File Interpreter ABI Platform
txt_from_pdf-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.5 kB

Release files / txt-from-pdf-1.3.1.tar.gz

Download URL txt-from-pdf-1.3.1.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
47f6fde02d3e56dd10f4339948f19dd95dfa0edcc659c530646402e03c7e8608
BLAKE2b-256 checksum
How to use checksums
a0f8af79d76ae77e71de7823f8235400b05709040822f5765668d96b63b7ed52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.10

Release files / txt_from_pdf-1.3.1-py3-none-any.whl

Download URL txt_from_pdf-1.3.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c76d9355b338ec5e73f2fefc8b61514378da82dba1a68bb6388ae89d305a9f9a
BLAKE2b-256 checksum
How to use checksums
7e0ec517db8c0b02c708894a5d7a09b97b3a7e6b38f9fba964db7476dc5c5784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.10

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page