from pathlib import Path from pypdf import PdfReader def main(): """ Print text from all pages of PDF file. """ file = Path("pdf.pdf") # Print text of all PDF pages. reader = PdfReader(file) for page in reader.pages: print(page.extract_text()) if __name__ == '__main__': main()