github.com/py-pdf

Slug: pypdf

412 characters 39 words
import os from pypdf import PdfReader pdf_file_path = "" file_name = os.path.splitext(pdf_file_path)[0] reader = PdfReader(pdf_file_path) text = "" for page in reader.pages: text += page.extract_text() + "\n" with open(f"{file_name}.txt", "w") as f: f.write(text) print(text)
URL: https://ib.bsb.br/pypdf
Reference: extrair texto de todo o PDF e salvar em um arquivo de texto