Make a notes on chapter puberty..make a detailed and exam oriented notes from the given source
python3 << 'EOF' import pdfplumber pdf_path = "/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" with pdfplumber.open(pdf_path) as pdf: print(f"Total pages: {len(pdf.pages)}") # Search for puberty chapter in first 50 pages for i, page in enumerate(pdf.pages[:60]): text = page.extract_text() if text and ('puberty' in text.lower() or 'PUBERTY' in text): print(f"Page {i+1}: Found puberty mention") print(text[:300]) print("---") EOF
python3 << 'EOF' import pdfplumber pdf_path = "/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" with pdfplumber.open(pdf_path) as pdf: # Search ALL pages for puberty for i, page in enumerate(pdf.pages): text = page.extract_text() if text and ('puberty' in text.lower() or 'PUBERTY' in text.upper()): print(f"Page {i+1}: {text[:200]}") print("---") EOF
python3 << 'EOF' import pdfplumber pdf_path = "/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" with pdfplumber.open(pdf_path) as pdf: # Check first few pages for table of contents for i in range(10): text = pdf.pages[i].extract_text() if text: print(f"=== PAGE {i+1} ===") print(text[:500]) print() EOF
python3 << 'EOF' import pdfplumber pdf_path = "/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" with pdfplumber.open(pdf_path) as pdf: # Try pypdf instead for text extraction page = pdf.pages[0] print("Page 1 words:", page.extract_words()[:20]) print("Page 1 text repr:", repr(page.extract_text())) EOF
python3 << 'EOF' from pypdf import PdfReader pdf_path = "/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" reader = PdfReader(pdf_path) print(f"Total pages: {len(reader.pages)}") # Check first page text = reader.pages[0].extract_text() print(f"Page 1 text: {repr(text[:500])}") # Check page 5 text5 = reader.pages[5].extract_text() print(f"Page 6 text: {repr(text5[:500])}") EOF
python3 << 'EOF' # Try OCR with pytesseract on a few pages to find puberty chapter import subprocess # First check what tools are available result = subprocess.run(['which', 'tesseract'], capture_output=True, text=True) print("tesseract:", result.stdout.strip()) result2 = subprocess.run(['which', 'pdftotext'], capture_output=True, text=True) print("pdftotext:", result2.stdout.strip()) result3 = subprocess.run(['which', 'pdftoppm'], capture_output=True, text=True) print("pdftoppm:", result3.stdout.strip()) EOF
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Try pdftotext first - works on some scanned PDFs with embedded text layer pdftotext "$pdf_path" /tmp/dutta_text.txt 2>&1 echo "Exit: $?" wc -c /tmp/dutta_text.txt head -c 2000 /tmp/dutta_text.txt
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" mkdir -p /tmp/puberty_ocr # Convert TOC pages (usually first 10-15 pages) to images and OCR them pdftoppm -r 200 -f 1 -l 15 "$pdf_path" /tmp/puberty_ocr/toc_page echo "Converted TOC pages" ls /tmp/puberty_ocr/ | head -20
# OCR the TOC pages to find puberty chapter page number for f in /tmp/puberty_ocr/toc_page-*.ppm; do name=$(basename $f .ppm) tesseract "$f" /tmp/puberty_ocr/$name -l eng --psm 6 quiet 2>/dev/null done echo "OCR done" # Search for puberty in TOC grep -i "puberty" /tmp/puberty_ocr/*.txt 2>/dev/null | head -20
# OCR just one page quickly tesseract /tmp/puberty_ocr/toc_page-005.ppm /tmp/toc5 -l eng --psm 6 2>/dev/null cat /tmp/toc5.txt | head -50
# OCR TOC page to find puberty chapter number - try pages 7-12 individually for pg in 7 8 9 10 11 12; do tesseract /tmp/puberty_ocr/toc_page-0$(printf '%02d' $pg).ppm /tmp/toc$pg -l eng --psm 6 2>/dev/null echo "=== Page $pg ===" grep -i "puberty\|Chapter 2\|Chapter 3\|Chapter 4" /tmp/toc$pg.txt 2>/dev/null | head -5 done
cat /tmp/toc8.txt | head -60
ls -la /tmp/toc*.txt 2>/dev/null
# Try to find the TOC page with better resolution pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Convert specific pages at high res pdftoppm -r 300 -f 6 -l 8 "$pdf_path" /tmp/hires_toc ls -la /tmp/hires_toc*.ppm 2>/dev/null
tesseract /tmp/hires_toc-006.ppm /tmp/hires_toc6 -l eng --psm 6 2>/dev/null cat /tmp/hires_toc6.txt
tesseract /tmp/hires_toc-007.ppm /tmp/hires_toc7 -l eng --psm 6 2>/dev/null cat /tmp/hires_toc7.txt | head -80
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Convert TOC pages 9-15 at high res pdftoppm -r 300 -f 9 -l 15 "$pdf_path" /tmp/hires2 ls /tmp/hires2*.ppm
tesseract /tmp/hires2-009.ppm /tmp/hires2_9 -l eng --psm 6 2>/dev/null cat /tmp/hires2_9.txt
tesseract /tmp/hires2-010.ppm /tmp/hires2_10 -l eng --psm 6 2>/dev/null cat /tmp/hires2_10.txt
tesseract /tmp/hires2-011.ppm /tmp/hires2_11 -l eng --psm 6 2>/dev/null cat /tmp/hires2_11.txt | head -60
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Pages 12-14 likely have the TOC pdftoppm -r 300 -f 12 -l 14 "$pdf_path" /tmp/hires3 tesseract /tmp/hires3-012.ppm /tmp/hires3_12 -l eng --psm 6 2>/dev/null cat /tmp/hires3_12.txt
tesseract /tmp/hires3-013.ppm /tmp/hires3_13 -l eng --psm 6 2>/dev/null cat /tmp/hires3_13.txt | head -60
tesseract /tmp/hires3-014.ppm /tmp/hires3_14 -l eng --psm 6 2>/dev/null cat /tmp/hires3_14.txt | head -80
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Pages 15-20 likely have the TOC pdftoppm -r 300 -f 15 -l 20 "$pdf_path" /tmp/hires4 tesseract /tmp/hires4-015.ppm /tmp/hires4_15 -l eng --psm 6 2>/dev/null cat /tmp/hires4_15.txt
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # The book starts at page 1 of PDF, but DC Dutta's TOC shows chapter 5 starts at page 39 # Need to find what PDF page corresponds to book page 39 # The TOC is at PDF page 15. Let's check what page 39-63 are in the PDF # Let's look at pages around PDF page 55 (offset for front matter ~16 pages) pdftoppm -r 250 -f 55 -l 56 "$pdf_path" /tmp/ch5test tesseract /tmp/ch5test-055.ppm /tmp/ch5test55 -l eng --psm 6 2>/dev/null echo "=== PDF PAGE 55 ===" cat /tmp/ch5test55.txt | head -15
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Let's scan pages around 50-60 to find "Puberty" chapter heading for pg in 50 51 52 53 54; do pdftoppm -r 200 -f $pg -l $pg "$pdf_path" /tmp/scanpg tesseract /tmp/scanpg-$(printf '%03d' $pg).ppm /tmp/scanpg_$pg -l eng --psm 6 2>/dev/null first=$(head -3 /tmp/scanpg_$pg.txt) echo "Page $pg: $first" done
pdf_path="/home/daytona/workspace/attachments/117a049b-ee32-4c9d-ae22-658b1420973e/DC Dutta's Textbook of Gynecology_11zon (1).pdf" # Chapter 4 ended around page 54, so Chapter 5 Puberty should start around page 55-60 for pg in 55 56 57 58 59 60; do pdftoppm -r 200 -f $pg -l $pg "$pdf_path" /tmp/scanpg2 tesseract /tmp/scanpg2-$(printf '%03d' $pg).ppm /tmp/scanpg2_$pg -l eng --psm 6 2>/dev/null first=$(head -3 /tmp/scanpg2_$pg.txt) echo "Page $pg: $first" done