pdf-replace/pdf_replace/print_text.py
2024-01-23 14:15:27 +01:00

20 lines
324 B
Python

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()