Skip to content

Extracting clean text from pdfs using pdfminer.six and pypdf.

License

Notifications You must be signed in to change notification settings

alisafaya/txt-from-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Extracting clean text from pdfs using pdfminer.six and pypdf.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages