Jun-13-2023, 07:16 PM
OK. I will try it.
(Jun-13-2023, 07:14 PM)deanhystad Wrote: What "gives you this stuff"?
Those are not error messages. Is your program printing something, or are this a message from PyPDF2? When are they printed? Are these output when you try to extract text from a page?
I would try something like this to diagnose.
import re from PyPDF2 import PdfReader date_regex = re.compile(r"Visit: (\d{2}/\d{2}/\d{4})") def split_pdf_by_date(pdf_path): pdf = PdfReader(pdf_path) for pagenum, page in enumerate(pdf.pages, start=1): print("Page", pagenum) text = page.extract_text() print("Search") print(re.search(date_regex, text), "\n") split_pdf_by_date("Test.pdf")