make detialed notes of rape part
python3 -c " import pdfplumber pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') # Extract first few pages to understand structure for i, page in enumerate(pdf.pages[:5]): text = page.extract_text() if text: print(f'--- PAGE {i+1} ---') print(text[:500]) print() "
python3 -c " import pdfplumber pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' with pdfplumber.open(pdf_path) as pdf: full_text = '' for i, page in enumerate(pdf.pages): text = page.extract_text() if text: full_text += f'\n=== PAGE {i+1} ===\n' + text print(full_text) " > /home/daytona/workspace/attachments/rape_raw.txt 2>&1 echo "Done. File size:" wc -l /home/daytona/workspace/attachments/rape_raw.txt
python3 << 'EOF' import pdfplumber pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' with pdfplumber.open(pdf_path) as pdf: full_text = '' for i, page in enumerate(pdf.pages): text = page.extract_text() if text: full_text += '\n=== PAGE ' + str(i+1) + ' ===\n' + text with open('/home/daytona/workspace/attachments/rape_raw.txt', 'w', encoding='utf-8') as f: f.write(full_text) print('Written. Lines:', full_text.count('\n')) print('First 2000 chars:') print(full_text[:2000]) EOF
python3 << 'EOF' import subprocess # Try using pypdf directly from pypdf import PdfReader pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' reader = PdfReader(pdf_path) print(f'Pages: {len(reader.pages)}') for i, page in enumerate(reader.pages[:3]): text = page.extract_text() print(f'Page {i+1} text length: {len(text) if text else 0}') if text: print(text[:300]) EOF
# Try OCR with pytesseract via pdf2image python3 << 'EOF' import subprocess result = subprocess.run(['which', 'tesseract'], capture_output=True, text=True) print('tesseract:', result.stdout.strip()) result2 = subprocess.run(['python3', '-c', 'import pdf2image; print("pdf2image ok")'], capture_output=True, text=True) print('pdf2image:', result2.stdout.strip(), result2.stderr.strip()) result3 = subprocess.run(['python3', '-c', 'import pytesseract; print("pytesseract ok")'], capture_output=True, text=True) print('pytesseract:', result3.stdout.strip(), result3.stderr.strip()) EOF
python3 << 'EOF' from pdf2image import convert_from_path import pytesseract pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' print("Converting PDF to images...") images = convert_from_path(pdf_path, dpi=200) print(f"Total pages: {len(images)}") full_text = "" for i, img in enumerate(images): print(f"OCR page {i+1}...") text = pytesseract.image_to_string(img, lang='eng') full_text += f"\n=== PAGE {i+1} ===\n" + text with open('/home/daytona/workspace/attachments/rape_ocr.txt', 'w', encoding='utf-8') as f: f.write(full_text) print(f"\nDone. Total chars: {len(full_text)}") print("\nFirst 3000 chars:") print(full_text[:3000]) EOF
# OCR just first 5 pages at lower DPI to get content python3 << 'EOF' from pdf2image import convert_from_path import pytesseract pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' images = convert_from_path(pdf_path, dpi=150, first_page=1, last_page=5) print(f"Pages converted: {len(images)}") for i, img in enumerate(images): text = pytesseract.image_to_string(img, lang='eng') print(f"\n=== PAGE {i+1} ===") print(text[:1500]) EOF
python3 << 'EOF' from pdf2image import convert_from_path import pytesseract pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' images = convert_from_path(pdf_path, dpi=150, first_page=6, last_page=11) for i, img in enumerate(images): text = pytesseract.image_to_string(img, lang='eng') print(f"\n=== PAGE {i+6} ===") print(text[:2000]) EOF
python3 << 'EOF' from pdf2image import convert_from_path import pytesseract pdf_path = '/home/daytona/workspace/attachments/b83a1eb0-c9d3-491e-b621-f1e27c53c13f/SEXUAL OFFENCES reddy (2).pdf' images = convert_from_path(pdf_path, dpi=150, first_page=12, last_page=22) for i, img in enumerate(images): text = pytesseract.image_to_string(img, lang='eng') print(f"\n=== PAGE {i+12} ===") print(text[:2000]) EOF