#!/usr/bin/env python3 import sys import os # Add the virtual environment to the path sys.path.insert(0, '/home/rpm/claude/ryanmalloy.com/static-files/documents/pdf_env/lib/python3.12/site-packages') from pypdf import PdfReader, PdfWriter import io def edit_pdf_text(input_path, output_path): """Edit PDF text to correct the Intouch Solutions end date.""" # First, let's get the original PDF and download from the correct source import urllib.request print("Downloading original PDF from static server...") urllib.request.urlretrieve("https://static.ryanmalloy.com/documents/Ryan_Malloy_Resume.pdf", "original_resume.pdf") reader = PdfReader("original_resume.pdf") writer = PdfWriter() print(f"PDF has {len(reader.pages)} pages") # Process each page for page_num, page in enumerate(reader.pages): print(f"Processing page {page_num + 1}") # Extract text to see what we're working with text = page.extract_text() # Check if this page contains the text we need to change if "02/2001 - 11/2002" in text: print(f"Found target text on page {page_num + 1}") print("Text replacement in PDF is complex - this approach has limitations") # For now, just add the page as-is writer.add_page(page) # Write the output with open(output_path, 'wb') as output_file: writer.write(output_file) print(f"PDF saved to: {output_path}") if __name__ == "__main__": edit_pdf_text("Ryan_Malloy_Resume.pdf", "Ryan_Malloy_Resume_edited.pdf")