pdf-replace/pdf_replace/print_text.py

20 lines
324 B
Python
Raw Permalink Normal View History

2024-01-23 14:15:27 +01:00
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()