Make some changes in the reasearch work , remove year 2024 from headers and title.add principal investigator name as Dr Sabitha Rose Jacob MD Community medicine Associate professor(cap)
cd /home/daytona/workspace && python3 -c " import pdfplumber pdf_path = '/home/daytona/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') # Print first 5 pages text for i in range(min(5, len(pdf.pages))): print(f'\\n--- PAGE {i+1} ---') text = pdf.pages[i].extract_text() print(text[:2000] if text else 'No text') "
I need front extra page with the matter like I uploaded in pic,i have uploaded logo pic,remove declaration page,modify certificate page like I uploaded in pic edit the document and give it as a printable file
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i in range(min(8, len(pdf.pages))): print(f'\\n=== PAGE {i+1} ===') text = pdf.pages[i].extract_text() print(text[:3000] if text else 'No text') "
mkdir -p /tmp/workspace/precocious_puberty && curl -s -o /tmp/workspace/precocious_puberty/logo.png "https://d361swluvexzqs.cloudfront.net/chats-attachments/Gemini_Generated_Image_2q75ud2q75ud2q75-1784885885082-nyeuxm.png" && echo "Logo downloaded: $(ls -lh /tmp/workspace/precocious_puberty/logo.png)"
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') # Print page 3 (certificate) full text for i in [2]: print(f'\\n=== PAGE {i+1} (CERTIFICATE) ===') text = pdf.pages[i].extract_text() print(text) "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_pdf.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, HRFlowable, Image as RLImage, Table, TableStyle from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY from reportlab.pdfgen import canvas from pypdf import PdfWriter, PdfReader PDF_PATH = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 # ───────────────────────────────────────────── # Helper: draw header on a canvas page # ───────────────────────────────────────────── HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" def draw_header(c, width, height): c.saveState() c.setFont("Helvetica", 7) c.setFillColor(colors.HexColor("#555555")) c.drawString(2*cm, height - 1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")) c.setLineWidth(0.5) c.line(2*cm, height - 1.4*cm, width - 2*cm, height - 1.4*cm) c.restoreState() # ───────────────────────────────────────────── # PAGE 0 – COVER PAGE (new, no header) # ───────────────────────────────────────────── def make_cover_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # Title c.setFont("Helvetica-Bold", 18) c.setFillColor(colors.HexColor("#1a1a1a")) title_lines = ["Prevalence of Precocious Puberty", "Among School Girls"] y = H - 3*cm for line in title_lines: c.drawCentredString(W/2, y, line) y -= 0.75*cm # Subtitle c.setFont("Helvetica", 11) c.setFillColor(colors.HexColor("#333333")) sub = "A Cross-Sectional Study in Manjeri & Anakkayam, Malappuram Dist., Kerala, India" c.drawCentredString(W/2, y - 0.4*cm, sub) y -= 1.6*cm # Divider c.setStrokeColor(colors.HexColor("#2c5f8a")) c.setLineWidth(1.2) c.line(3*cm, y, W - 3*cm, y) y -= 0.4*cm # Logo logo_w = 6*cm logo_h = 6*cm logo_x = (W - logo_w) / 2 logo_y = y - logo_h - 0.6*cm c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_w, height=logo_h, preserveAspectRatio=True, mask='auto') y = logo_y - 1.2*cm # Divider c.setStrokeColor(colors.HexColor("#2c5f8a")) c.setLineWidth(1.2) c.line(3*cm, y, W - 3*cm, y) y -= 1.0*cm # Department & College c.setFont("Helvetica-Bold", 13) c.setFillColor(colors.HexColor("#1a1a1a")) c.drawCentredString(W/2, y, "Department of Community Medicine") y -= 0.7*cm c.setFont("Helvetica-Bold", 13) c.drawCentredString(W/2, y, "Government Medical College Manjeri") y -= 0.5*cm c.setFont("Helvetica", 11) c.setFillColor(colors.HexColor("#444444")) c.drawCentredString(W/2, y, "Malappuram – 676 121, Kerala, India") c.save() buf.seek(0) return buf # ───────────────────────────────────────────── # PAGE C – CERTIFICATE PAGE (new, with header) # ───────────────────────────────────────────── def make_certificate_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) draw_header(c, W, H) y = H - 2.8*cm # Title c.setFont("Helvetica-Bold", 14) c.setFillColor(colors.HexColor("#1a1a1a")) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.3*cm c.setStrokeColor(colors.HexColor("#1a1a1a")) c.setLineWidth(1) title_w = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.line((W - title_w)/2, y, (W + title_w)/2, y) y -= 0.9*cm # Body text – word-wrap with reportlab text object body_text = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty Among School Girls\u201d " "is a bona fide record of work submitted by Sariga M G and Co-Investigators " "(SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, Nahnu Rinsha P, Ramgopal K, " "Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, Shifana Nasrin, Shinsiya Sherin PP, " "Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) of 2023 MBBS Batch to the Department of " "Community Medicine, Government Medical College Manjeri, during the academic year 2025\u20132026." ) # Use a text-wrap approach from reportlab.platypus import Paragraph from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY style = ParagraphStyle( 'body', fontName='Helvetica', fontSize=11, leading=17, alignment=TA_JUSTIFY, spaceAfter=0 ) p = Paragraph(body_text, style) left_margin = 2.5*cm text_width = W - 5*cm pw, ph = p.wrap(text_width, 400) p.drawOn(c, left_margin, y - ph) y -= ph + 1.4*cm # Guided by section c.setFont("Helvetica-Bold", 11) c.setFillColor(colors.HexColor("#1a1a1a")) c.drawString(2.5*cm, y, "Guided by:") y -= 0.8*cm # Two-column guide section col1_x = 2.5*cm col2_x = W/2 + 0.5*cm # Guide 1 c.setFont("Helvetica-Bold", 10.5) c.drawString(col1_x, y, "1. Dr. Sabitha Rose Jacob") c.setFont("Helvetica", 10) y1 = y - 0.55*cm c.drawString(col1_x + 0.4*cm, y1, "MD Community Medicine,") y1 -= 0.5*cm c.drawString(col1_x + 0.4*cm, y1, "Associate Professor (CAP)") y1 -= 0.5*cm # Guide 2 (right column) c.setFont("Helvetica-Bold", 10.5) c.drawString(col2_x, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica", 10) y2 = y - 0.55*cm c.drawString(col2_x + 0.4*cm, y2, "MD Community Medicine,") y2 -= 0.5*cm c.drawString(col2_x + 0.4*cm, y2, "Assistant Professor") y2 -= 0.5*cm # Department line under guide 1 y_dept = min(y1, y2) - 0.2*cm c.setFont("Helvetica", 10) c.drawString(col1_x + 0.4*cm, y_dept, "Dept. of Community Medicine") y_dept -= 0.5*cm c.drawString(col1_x + 0.4*cm, y_dept, "Government Medical College Manjeri") y_dept -= 0.5*cm c.setFont("Helvetica", 10) c.drawString(col2_x + 0.4*cm, min(y1, y2) - 0.2*cm, "Dept. of Community Medicine") c.drawString(col2_x + 0.4*cm, min(y1, y2) - 0.7*cm, "Government Medical College Manjeri") # Signature lines y_sig = y_dept - 1.2*cm c.setFont("Helvetica", 10) sig_len = 5*cm # Col1 sig c.drawString(col1_x, y_sig + 0.15*cm, "Signature: ") c.setStrokeColor(colors.black) c.line(col1_x + 2.2*cm, y_sig, col1_x + 2.2*cm + sig_len, y_sig) # Col2 sig c.drawString(col2_x, y_sig + 0.15*cm, "Signature: ") c.line(col2_x + 2.2*cm, y_sig, col2_x + 2.2*cm + sig_len, y_sig) y_sig -= 0.9*cm c.drawString(col1_x, y_sig + 0.15*cm, "Date: ") c.line(col1_x + 2.2*cm, y_sig, col1_x + 2.2*cm + sig_len, y_sig) c.drawString(col2_x, y_sig + 0.15*cm, "Date: ") c.line(col2_x + 2.2*cm, y_sig, col2_x + 2.2*cm + sig_len, y_sig) # Page number c.setFont("Helvetica", 9) c.setFillColor(colors.HexColor("#666666")) c.drawCentredString(W/2, 1.5*cm, "Page C") c.save() buf.seek(0) return buf # ───────────────────────────────────────────── # MAIN: Assemble final PDF # ───────────────────────────────────────────── writer = PdfWriter() # 1. Cover page (new) cover_buf = make_cover_page() cover_reader = PdfReader(cover_buf) writer.add_page(cover_reader.pages[0]) # 2. Original page 1 (title/main page) – skip page 2 (declaration), include page 3 onwards source_reader = PdfReader(PDF_PATH) total = len(source_reader.pages) print(f"Source PDF total pages: {total}") # Page indices: 0=title, 1=declaration(SKIP), 2=certificate(REPLACE), 3..=rest # Add original page 0 (title page) – keep it writer.add_page(source_reader.pages[0]) # Add new certificate page cert_buf = make_certificate_page() cert_reader = PdfReader(cert_buf) writer.add_page(cert_reader.pages[0]) # Add all remaining pages (skip index 1=declaration, skip index 2=original cert, start from 3) for i in range(3, total): writer.add_page(source_reader.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done! Output: {OUT_PATH}") print(f"Output size: {os.path.getsize(OUT_PATH)/1024:.1f} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_pdf.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i in range(min(5, len(pdf.pages))): print(f'\\n=== PAGE {i+1} ===') text = pdf.pages[i].extract_text() print(text[:1500] if text else 'No text / image-based page') "
| # | Change | Details |
|---|---|---|
| 1 | New front cover page added | Title "Prevalence of Precocious Puberty Among School Girls", subtitle with Manjeri & Anakkayam study info, GMC Manjeri logo centered, Department of Community Medicine + Government Medical College Manjeri at bottom |
| 2 | Declaration page removed | Page 2 (Declaration) has been completely removed from the document |
| 3 | Certificate page rewritten | Now reads "project titled..." (not "research work"), names Sariga M G + all Co-Investigators, 2023 MBBS Batch, academic year 2025-2026, with two-column "Guided by" section |
| 4 | Two guides on certificate | Guide 1: Dr. Sabitha Rose Jacob – MD Community Medicine, Associate Professor (CAP); Guide 2: Dr. Remiza Rayikkal Answar – MD Community Medicine, Assistant Professor |
| 5 | All page headers | Already show "Government Medical College Manjeri" (no "2024") as in the uploaded version |
Precocious Puberty Thesis Final
PDF Document · PDF
The front extra page layout is not properly done please correct it to match like second page title on top logo in middle dept and college name at bottom give a professional look
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i in [0, 1]: print(f'\\n=== PAGE {i+1} ===') text = pdf.pages[i].extract_text() print(text) "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_final2.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_CENTER from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 # 595.28 x 841.89 pts # ── colour palette matching a formal academic document ── DARK_BLUE = colors.HexColor("#1B3A6B") MID_BLUE = colors.HexColor("#2C5F8A") LIGHT_RULE = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#444444") # ── helper: wrap a string into lines at a given max width ── def wrap_text(c, text, font, size, max_width): words = text.split() lines, line = [], "" for w in words: test = (line + " " + w).strip() if c.stringWidth(test, font, size) <= max_width: line = test else: if line: lines.append(line) line = w if line: lines.append(line) return lines def draw_cover_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) left = 2.8*cm right = W - 2.8*cm txt_w = right - left # ── TOP BAND (thin rule + PREVALENCE OF… heading) ────────────────────── band_y = H - 2.0*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2) c.line(left, band_y, right, band_y) # Main title – large, bold, dark blue, centred title1 = "PREVALENCE OF PRECOCIOUS PUBERTY" title2 = "AMONG SCHOOL GIRLS" c.setFont("Helvetica-Bold", 20) c.setFillColor(DARK_BLUE) t1y = H - 3.1*cm c.drawCentredString(W/2, t1y, title1) t2y = t1y - 0.80*cm c.drawCentredString(W/2, t2y, title2) # Subtitle line sub = "A Cross-Sectional Study in Manjeri and Anakkayam, Malappuram District, Kerala, India" c.setFont("Helvetica-Oblique", 11) c.setFillColor(GREY) sub_lines = wrap_text(c, sub, "Helvetica-Oblique", 11, txt_w) sub_y = t2y - 0.70*cm for ln in sub_lines: c.drawCentredString(W/2, sub_y, ln) sub_y -= 0.45*cm # Thin rule below subtitle rule1_y = sub_y - 0.30*cm c.setStrokeColor(LIGHT_RULE); c.setLineWidth(0.8) c.line(left, rule1_y, right, rule1_y) # ── LOGO – exact vertical centre of the page ─────────────────────────── logo_size = 7.5*cm # square bounding box logo_x = (W - logo_size) / 2 # page centre = H/2; nudge slightly up so it feels balanced with more text below logo_y = H/2 - logo_size/2 + 0.5*cm c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') # ── BOTTOM SECTION ──────────────────────────────────────────────────── # Rule above bottom block rule2_y = logo_y - 1.4*cm c.setStrokeColor(LIGHT_RULE); c.setLineWidth(0.8) c.line(left, rule2_y, right, rule2_y) # "A Research Work submitted in partial fulfilment…" submit_text = ("A Research Work submitted in partial fulfilment of the requirements of " "Third Year MBBS Research Project") c.setFont("Helvetica", 10.5) c.setFillColor(GREY) sm_lines = wrap_text(c, submit_text, "Helvetica", 10.5, txt_w) sm_y = rule2_y - 0.55*cm for ln in sm_lines: c.drawCentredString(W/2, sm_y, ln) sm_y -= 0.45*cm sm_y -= 0.25*cm # Academic year c.setFont("Helvetica-Bold", 10.5) c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, sm_y, "Academic Year: 2025 – 2026") sm_y -= 0.80*cm # Thick rule before institution block c.setStrokeColor(DARK_BLUE); c.setLineWidth(2) c.line(left, sm_y, right, sm_y) sm_y -= 0.60*cm # Department name c.setFont("Helvetica-Bold", 13) c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, sm_y, "Department of Community Medicine") sm_y -= 0.65*cm # College name c.setFont("Helvetica-Bold", 13) c.drawCentredString(W/2, sm_y, "Government Medical College Manjeri") sm_y -= 0.55*cm # Address c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawCentredString(W/2, sm_y, "Malappuram – 676 121, Kerala, India") sm_y -= 0.60*cm # Bottom rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(2) c.line(left, sm_y, right, sm_y) c.save() buf.seek(0) return buf # ── Certificate page (unchanged from previous build) ───────────────────── HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" def draw_header(c): c.saveState() c.setFont("Helvetica", 7) c.setFillColor(colors.HexColor("#555555")) c.drawString(2.8*cm, H - 1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5) c.line(2.8*cm, H - 1.4*cm, W - 2.8*cm, H - 1.4*cm) c.restoreState() def make_certificate_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) draw_header(c) left = 2.8*cm; right = W - 2.8*cm; txt_w = right - left y = H - 2.8*cm # Title c.setFont("Helvetica-Bold", 14) c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.28*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1) c.line((W - tw)/2, y, (W + tw)/2, y) y -= 1.0*cm # Body body = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty Among " "School Girls\u201d is a bona fide record of work submitted by Sariga M G and Co-Investigators " "(SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, Nahnu Rinsha P, Ramgopal K, " "Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, Shifana Nasrin, Shinsiya Sherin PP, " "Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) of 2023 MBBS Batch to the Department of " "Community Medicine, Government Medical College Manjeri, during the academic year 2025\u20132026." ) from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY style = ParagraphStyle('b', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(txt_w, 600) p.drawOn(c, left, y - ph) y -= ph + 1.6*cm # Guided by c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(left, y, "Guided by:") y -= 0.85*cm col1 = left; col2 = W/2 + 0.5*cm def guide_block(x, num, name, desig1, desig2): c.setFont("Helvetica-Bold", 10.5); c.setFillColor(BLACK) c.drawString(x, y, f"{num}. {name}") c.setFont("Helvetica", 10); c.setFillColor(GREY) c.drawString(x + 0.5*cm, y - 0.55*cm, desig1) c.drawString(x + 0.5*cm, y - 1.05*cm, desig2) guide_block(col1, "1", "Dr. Sabitha Rose Jacob", "MD Community Medicine,", "Associate Professor (CAP)") guide_block(col2, "2", "Dr. Remiza Rayikkal Answar", "MD Community Medicine,", "Assistant Professor") y -= 1.3*cm # Dept lines c.setFont("Helvetica", 10); c.setFillColor(GREY) c.drawString(col1 + 0.5*cm, y, "Dept. of Community Medicine") c.drawString(col2 + 0.5*cm, y, "Dept. of Community Medicine") y -= 0.50*cm c.drawString(col1 + 0.5*cm, y, "Govt. Medical College Manjeri") c.drawString(col2 + 0.5*cm, y, "Govt. Medical College Manjeri") y -= 1.1*cm # Signature lines sig_len = 5*cm for x in [col1, col2]: c.setFont("Helvetica", 10); c.setFillColor(BLACK) c.drawString(x, y + 0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 10) c.setStrokeColor(BLACK); c.setLineWidth(0.6) c.line(x + sw, y, x + sw + sig_len, y) y -= 0.85*cm for x in [col1, col2]: c.setFont("Helvetica", 10); c.setFillColor(BLACK) c.drawString(x, y + 0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 10) c.setStrokeColor(BLACK); c.setLineWidth(0.6) c.line(x + dw, y, x + dw + sig_len, y) c.save(); buf.seek(0) return buf # ── Assemble ───────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) # 1. New cover page cov = PdfReader(draw_cover_page()); writer.add_page(cov.pages[0]) # 2. Original page 1 (title/main page, index 0 in source) writer.add_page(src.pages[0]) # 3. New certificate page (replaces original cert at index 2; skip declaration at index 1) cert = PdfReader(make_certificate_page()); writer.add_page(cert.pages[0]) # 4. Remaining pages (skip indices 1 & 2, keep 3 onwards) for i in range(3, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done – {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)/1024:.0f} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_final2.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') print('\\n=== PAGE 1 (new cover) ===') text = pdf.pages[0].extract_text() print(text) print('\\n=== PAGE 2 (original title) ===') text2 = pdf.pages[1].extract_text() print(text2[:800]) "
Precocious Puberty Thesis Final
PDF Document · PDF
On page 2 and 3 remove header title,on cover page remove line about reaserch work submitted , remove acadmic year line,also remove adress of college just write government medical college manjeri.spacing in guides , designation and following lines are not properly formatted.
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: for i in [1, 2]: print(f'\\n=== PAGE {i+1} ===') text = pdf.pages[i].extract_text() print(text) "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v3.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm, mm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame, KeepInFrame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY, TA_LEFT from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 # 595.28 x 841.89 pts L = 2.8*cm # left margin R = W - 2.8*cm TW = R - L # text width DARK_BLUE = colors.HexColor("#1B3A6B") MID_BLUE = colors.HexColor("#2C5F8A") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") # ───────────────────────────────────────────────────────────────────────────── # PAGE 1 – COVER PAGE # Layout: title top | logo centre | college name bottom (nothing else) # ───────────────────────────────────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # ── TOP SECTION ───────────────────────────────────────────────────────── # top rule top_rule_y = H - 2.0*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, top_rule_y, R, top_rule_y) # Title line 1 c.setFont("Helvetica-Bold", 22) c.setFillColor(DARK_BLUE) y = top_rule_y - 1.0*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") # Title line 2 y -= 0.9*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") # Subtitle y -= 0.75*cm c.setFont("Helvetica-Oblique", 11) c.setFillColor(GREY) sub = "A Cross-Sectional Study in Manjeri and Anakkayam, Malappuram District, Kerala, India" # manually centre-wrap sub_lines = ["A Cross-Sectional Study in Manjeri and Anakkayam,", "Malappuram District, Kerala, India"] for ln in sub_lines: c.drawCentredString(W/2, y, ln) y -= 0.48*cm # thin rule y -= 0.25*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8) c.line(L, y, R, y) # ── LOGO – true vertical centre of page ───────────────────────────────── logo_size = 8.0*cm logo_x = (W - logo_size) / 2 logo_y = (H / 2) - (logo_size / 2) # exact centre c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') # ── BOTTOM SECTION ─────────────────────────────────────────────────────── # thick rule above institution block bot_rule_y = logo_y - 1.6*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, bot_rule_y, R, bot_rule_y) by = bot_rule_y - 0.80*cm c.setFont("Helvetica-Bold", 14) c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine") by -= 0.70*cm c.setFont("Helvetica-Bold", 14) c.drawCentredString(W/2, by, "Government Medical College Manjeri") by -= 0.55*cm # bottom closing rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, by, R, by) c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # PAGE 2 – TITLE / MAIN PAGE (no header, same content as original page 1) # ───────────────────────────────────────────────────────────────────────────── def make_title_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # NO header # Title block y = H - 3.0*cm c.setFont("Helvetica-Bold", 18) c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.80*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") y -= 0.60*cm c.setFont("Helvetica", 11) c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.45*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") y -= 0.55*cm # horizontal rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(1.2) c.line(L, y, R, y) y -= 0.80*cm # ── Principal Investigator ─────────────────────────────────────────────── c.setFont("Helvetica-Bold", 11) c.setFillColor(BLACK) c.drawString(L, y, "Principal Investigator:") y -= 0.55*cm c.setFont("Helvetica-Bold", 11) c.setFillColor(DARK_BLUE) c.drawString(L + 0.5*cm, y, "Sariga M G") y -= 0.45*cm c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawString(L + 0.5*cm, y, "Third Year MBBS, Government Medical College Manjeri") y -= 0.80*cm # ── Co-Investigators ───────────────────────────────────────────────────── c.setFont("Helvetica-Bold", 11) c.setFillColor(BLACK) c.drawString(L, y, "Co-Investigators:") y -= 0.50*cm co_invs = [ "SP Keerthana | Krishna N | Rajkumar Barwal | Sabah Rahman | Nahnu Rinsha P", "Ramgopal K | Rimjhim Merotha | Roshani Kumari Jatav | Shifana M | Shifana Nasrin", "Shinsiya Sherin PP | Sideeque Ali | Suman Meena | Vivek T | Aiswarya T K" ] c.setFont("Helvetica", 10) c.setFillColor(GREY) for ln in co_invs: c.drawCentredString(W/2, y, ln) y -= 0.45*cm y -= 0.35*cm # thin rule c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.6) c.line(L, y, R, y) y -= 0.75*cm # ── Guides ─────────────────────────────────────────────────────────────── c.setFont("Helvetica-Bold", 11) c.setFillColor(BLACK) c.drawString(L, y, "Guides:") y -= 0.65*cm # Guide 1 c.setFont("Helvetica-Bold", 11) c.setFillColor(DARK_BLUE) c.drawString(L + 0.3*cm, y, "1. Dr. Sabitha Rose Jacob") y -= 0.50*cm c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawString(L + 0.8*cm, y, "MD Community Medicine, Associate Professor (CAP)") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Department of Community Medicine") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Government Medical College Manjeri") y -= 0.75*cm # Guide 2 c.setFont("Helvetica-Bold", 11) c.setFillColor(DARK_BLUE) c.drawString(L + 0.3*cm, y, "2. Dr. Remiza Rayikkal Answar") y -= 0.50*cm c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawString(L + 0.8*cm, y, "MD Community Medicine, Assistant Professor") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Department of Community Medicine") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Government Medical College Manjeri") y -= 0.80*cm # rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(1.2) c.line(L, y, R, y) y -= 0.65*cm # IEC / IRC c.setFont("Helvetica", 10) c.setFillColor(GREY) c.drawCentredString(W/2, y, "IEC Ref. No.: IEC/GMCM/204/2026 | IRC Approval No.: IRC/GMCM/313") c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # PAGE 3 – CERTIFICATE (no header, properly spaced guides) # ───────────────────────────────────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # NO header y = H - 3.0*cm # ── Title ──────────────────────────────────────────────────────────────── c.setFont("Helvetica-Bold", 14) c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.30*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y) y -= 1.1*cm # ── Body text ──────────────────────────────────────────────────────────── body = ( "This is to certify that the project titled <b>\u201cPrevalence of Precocious Puberty " "Among School Girls\u201d</b> is a bona fide record of work submitted by <b>Sariga M G</b> " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of <b>2023 MBBS Batch</b> to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year <b>2025\u20132026</b>." ) style = ParagraphStyle('body', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(TW, 500) p.drawOn(c, L, y - ph) y -= ph + 1.8*cm # ── "Guided by:" label ─────────────────────────────────────────────────── c.setFont("Helvetica-Bold", 11) c.setFillColor(BLACK) c.drawString(L, y, "Guided by:") y -= 1.0*cm # ── Two-column guide block ─────────────────────────────────────────────── # Each guide: Name (bold), then Designation, then Dept, then College # stacked vertically, side by side COL1 = L + 0.5*cm COL2 = W/2 + 1.0*cm LINE_GAP = 0.52*cm def guide_col(x, num, name, desig, dept, college): c.setFont("Helvetica-Bold", 11) c.setFillColor(DARK_BLUE) c.drawString(x, y, f"{num}. {name}") c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawString(x + 0.5*cm, y - LINE_GAP, desig) c.drawString(x + 0.5*cm, y - LINE_GAP*2, dept) c.drawString(x + 0.5*cm, y - LINE_GAP*3, college) guide_col(COL1, "1", "Dr. Sabitha Rose Jacob", "MD Community Medicine,", "Associate Professor (CAP)", "Dept. of Community Medicine,") guide_col(COL2, "2", "Dr. Remiza Rayikkal Answar", "MD Community Medicine,", "Assistant Professor", "Dept. of Community Medicine,") # College name row (below the 3 lines above) y_college = y - LINE_GAP*4 c.setFont("Helvetica", 10.5) c.setFillColor(GREY) c.drawString(COL1 + 0.5*cm, y_college, "Govt. Medical College Manjeri") c.drawString(COL2 + 0.5*cm, y_college, "Govt. Medical College Manjeri") # Signature rows y_sig = y_college - 1.4*cm SIG_LEN = 5.5*cm c.setFont("Helvetica", 11) c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig + 0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + sw, y_sig, x + sw + SIG_LEN, y_sig) y_date = y_sig - 1.0*cm for x in [COL1, COL2]: c.drawString(x, y_date + 0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + dw, y_date, x + dw + SIG_LEN, y_date) c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # ASSEMBLE # ───────────────────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) writer.add_page(PdfReader(make_cover()).pages[0]) # Page 1: cover writer.add_page(PdfReader(make_title_page()).pages[0]) # Page 2: title (no header) writer.add_page(PdfReader(make_certificate()).pages[0]) # Page 3: certificate (no header) # Skip original pages 0 (title), 1 (declaration), 2 (certificate) → start from index 3 for i in range(3, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) sz = os.path.getsize(OUT_PATH) print(f"Done — {len(writer.pages)} pages | {sz/1024:.0f} KB → {OUT_PATH}") PYEOF python3 /tmp/workspace/precocious_puberty/build_v3.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i in [0,1,2,3]: print(f'\\n=== PAGE {i+1} ===') print(pdf.pages[i].extract_text()) "
Precocious Puberty Thesis Final
PDF Document · PDF
On cover page lower college name slight on bottom,don't change style of second page from earlier pdf ,don't bolden sarigas name in certificate
python3 -c " import pdfplumber # Check original source PDF page 1 (index 0) for style reference pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Source pages: {len(pdf.pages)}') page = pdf.pages[0] print('\\n--- TEXT ---') print(page.extract_text()) print('\\n--- CHARS sample (font info) ---') chars = page.chars[:40] for ch in chars: print(f\" char='{ch['text']}' font={ch.get('fontname','?')} size={ch.get('size','?'):.1f} x={ch.get('x0','?'):.1f} y={ch.get('y0','?'):.1f}\") "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v4.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY from pypdf import PdfWriter, PdfReader, PageObject from pypdf.generic import RectangleObject PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 # 595.28 x 841.89 pts L = 2.8*cm R = W - 2.8*cm TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") # ───────────────────────────────────────────────────────────────────────────── # Helper: make a white-overlay PDF page to blank out a header strip # ───────────────────────────────────────────────────────────────────────────── def make_white_overlay_for_header(): """Returns a single-page PDF (buffer) with a white rectangle covering only the top header band (approx top 1.6 cm).""" buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFillColor(colors.white) c.setStrokeColor(colors.white) # Cover top 1.6 cm = 45 pts c.rect(0, H - 45, W, 45, fill=1, stroke=0) c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # PAGE 1 – COVER (college name pushed lower) # ───────────────────────────────────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # top rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H - 2.0*cm, R, H - 2.0*cm) # Title c.setFont("Helvetica-Bold", 22) c.setFillColor(DARK_BLUE) y = H - 3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") # Subtitle y -= 0.72*cm c.setFont("Helvetica-Oblique", 11) c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") # thin rule below subtitle y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8) c.line(L, y, R, y) # ── LOGO – exact page centre ───────────────────────────────────────────── logo_size = 8.0*cm logo_x = (W - logo_size) / 2 logo_y = (H / 2) - (logo_size / 2) c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') # ── BOTTOM – pushed lower: thick rule at ~3.5 cm from bottom ───────────── # Previously the block was at logo_y - 1.6cm. Now anchor to bottom margin. bot_thick_rule = 4.8*cm # distance from bottom edge c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, bot_thick_rule, R, bot_thick_rule) by = bot_thick_rule - 0.75*cm c.setFont("Helvetica-Bold", 14) c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine") by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri") by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, by, R, by) c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # PAGE 3 – CERTIFICATE (no header, Sariga M G NOT bolded) # ───────────────────────────────────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H - 3.0*cm # Title c.setFont("Helvetica-Bold", 14) c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.30*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y) y -= 1.1*cm # Body – Sariga M G plain (not bold) body = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026." ) style = ParagraphStyle('body', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(TW, 500) p.drawOn(c, L, y - ph) y -= ph + 1.8*cm # Guided by label c.setFont("Helvetica-Bold", 11) c.setFillColor(BLACK) c.drawString(L, y, "Guided by:") y -= 1.0*cm COL1 = L + 0.5*cm COL2 = W/2 + 1.0*cm LG = 0.52*cm # line gap # Names c.setFont("Helvetica-Bold", 11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica", 10.5); c.setFillColor(GREY) # Row 1: designation line 1 c.drawString(COL1 + 0.5*cm, y - LG, "MD Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG, "MD Community Medicine,") # Row 2: designation line 2 c.drawString(COL1 + 0.5*cm, y - LG*2, "Associate Professor (CAP)") c.drawString(COL2 + 0.5*cm, y - LG*2, "Assistant Professor") # Row 3: dept c.drawString(COL1 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") # Row 4: college c.drawString(COL1 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") c.drawString(COL2 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") # Signature block y_sig = y - LG*4 - 1.4*cm SIG_LEN = 5.5*cm c.setFont("Helvetica", 11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig + 0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + sw, y_sig, x + sw + SIG_LEN, y_sig) y_date = y_sig - 1.0*cm for x in [COL1, COL2]: c.drawString(x, y_date + 0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + dw, y_date, x + dw + SIG_LEN, y_date) c.save(); buf.seek(0) return buf # ───────────────────────────────────────────────────────────────────────────── # ASSEMBLE # ───────────────────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) # ── Page 1: new cover ──────────────────────────────────────────────────────── writer.add_page(PdfReader(make_cover()).pages[0]) # ── Page 2: original title page (index 0) with header blanked out ──────────── orig_title = src.pages[0] overlay_reader = PdfReader(make_white_overlay_for_header()) orig_title.merge_page(overlay_reader.pages[0]) writer.add_page(orig_title) # ── Page 3: new certificate (no header, Sariga plain) ──────────────────────── writer.add_page(PdfReader(make_certificate()).pages[0]) # ── Remaining pages: skip src indices 0 (title), 1 (declaration), 2 (cert) ── for i in range(3, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v4.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: for i in [0,1,2]: print(f'\\n=== PAGE {i+1} ===') print(pdf.pages[i].extract_text()) "
Precocious Puberty Thesis Final
PDF Document · PDF
| Page | Change |
|---|---|
| Cover (p.1) | "Department of Community Medicine" + "Government Medical College Manjeri" block pushed down, anchored near bottom with rules |
| Title page (p.2) | Original PDF page used as-is (preserving exact fonts, layout, spacing) - header band covered with white overlay |
| Certificate (p.3) | "Sariga M G" is now plain weight (not bold); guide block properly spaced with name/designation/dept/college on separate rows |
In acknowledgement page please bolden dr names
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') print('\\n=== PAGE 4 (Acknowledgements) ===') print(pdf.pages[3].extract_text()) "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v5.py import io, os, re from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY, TA_CENTER from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 L = 2.8*cm; R = W - 2.8*cm; TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") # ── white overlay to blank the header strip ─────────────────────────────── def make_white_header_overlay(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFillColor(colors.white); c.setStrokeColor(colors.white) c.rect(0, H - 45, W, 45, fill=1, stroke=0) c.save(); buf.seek(0) return buf # ── PAGE 1: cover ───────────────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H - 2.0*cm, R, H - 2.0*cm) c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) y = H - 3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") y -= 0.72*cm c.setFont("Helvetica-Oblique", 11); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8) c.line(L, y, R, y) logo_size = 8.0*cm logo_x = (W - logo_size) / 2 logo_y = (H / 2) - (logo_size / 2) c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') bot = 4.8*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, bot, R, bot) by = bot - 0.75*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine") by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri") by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, by, R, by) c.save(); buf.seek(0) return buf # ── PAGE 3: certificate ─────────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H - 3.0*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.30*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y) y -= 1.1*cm body = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026." ) style = ParagraphStyle('body', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(TW, 500) p.drawOn(c, L, y - ph) y -= ph + 1.8*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Guided by:") y -= 1.0*cm COL1 = L + 0.5*cm; COL2 = W/2 + 1.0*cm; LG = 0.52*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica", 10.5); c.setFillColor(GREY) c.drawString(COL1 + 0.5*cm, y - LG, "MD Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG, "MD Community Medicine,") c.drawString(COL1 + 0.5*cm, y - LG*2, "Associate Professor (CAP)") c.drawString(COL2 + 0.5*cm, y - LG*2, "Assistant Professor") c.drawString(COL1 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") c.drawString(COL1 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") c.drawString(COL2 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") y_sig = y - LG*4 - 1.4*cm; SIG_LEN = 5.5*cm c.setFont("Helvetica", 11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig + 0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + sw, y_sig, x + sw + SIG_LEN, y_sig) y_date = y_sig - 1.0*cm for x in [COL1, COL2]: c.drawString(x, y_date + 0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + dw, y_date, x + dw + SIG_LEN, y_date) c.save(); buf.seek(0) return buf # ── PAGE 4: acknowledgements – Dr. names bolded ────────────────────────── HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" def make_acknowledgements(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # Header (matching original pages) c.setFont("Helvetica", 7.5); c.setFillColor(colors.HexColor("#555555")) c.drawString(L, H - 1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5) c.line(L, H - 1.4*cm, R, H - 1.4*cm) y = H - 2.8*cm # Section title c.setFont("Helvetica-Bold", 13); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "ACKNOWLEDGEMENTS") y -= 1.0*cm # Paragraphs with Dr. names bolded using Paragraph (HTML-like markup) body_style = ParagraphStyle( 'ack', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY, spaceAfter=10 ) paras = [ ("We owe our deepest gratitude to <b>Dr. Priya Chandran</b>, MD, Professor and Head of the " "Department of Community Medicine, Government Medical College Manjeri, whose visionary " "leadership, unwavering encouragement, and magnanimous support made this research endeavour " "possible. Her expert guidance at every stage of the project, her accessibility and willingness " "to help in every way possible, and the academic environment she has fostered in the department " "have been the bedrock upon which this work stands. We are truly fortunate to have had the " "benefit of her mentorship."), ("We sincerely thank our guides, <b>Dr. Sabitha Rose Jacob</b>, MD, Associate Professor (CAP), " "and <b>Dr. Remiza Rayikkal Answar</b>, MD, Assistant Professor, Department of Community " "Medicine, Government Medical College Manjeri, for their meticulous guidance, scholarly input, " "constant motivation, and patient supervision throughout this project."), ("We extend our sincere gratitude to the Principal, Government Medical College Manjeri, for the " "institutional support extended to this research. We are deeply thankful to the Institutional " "Ethics Committee (IEC), Government Medical College Manjeri (Ref. No.: IEC/GMCM/204/2026) " "and the Institutional Research Committee (IRC No.: IRC/GMCM/313) for their timely review and " "approval. We thank the principals, teachers, and management of Benchmark International School " "Manjeri, Government Higher Secondary School (Girls) Manjeri, and Government Higher Secondary " "School Irumbuzhi, Anakkayam, for their wholehearted cooperation in facilitating data collection."), ("Our heartfelt thanks go to all the student participants and their parents/guardians who " "generously gave their time and shared information that forms the foundation of this study. " "Their willingness to contribute to scientific knowledge is greatly appreciated. We also thank " "all co-investigators for their support during data collection. This work was conducted in " "compliance with ICMR Ethical Guidelines for Biomedical Research on Human Participants (2017)."), ] frame = Frame(L, 1.5*cm, TW, y - 1.5*cm, leftPadding=0, rightPadding=0, topPadding=0, bottomPadding=0) story = [] for txt in paras: story.append(Paragraph(txt, body_style)) frame.addFromList(story, c) # Page number c.setFont("Helvetica", 9); c.setFillColor(GREY) c.drawCentredString(W/2, 1.0*cm, "Page 4") c.save(); buf.seek(0) return buf # ── ASSEMBLE ───────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) # Page 1: cover writer.add_page(PdfReader(make_cover()).pages[0]) # Page 2: original title page with header blanked orig_title = src.pages[0] orig_title.merge_page(PdfReader(make_white_header_overlay()).pages[0]) writer.add_page(orig_title) # Page 3: certificate writer.add_page(PdfReader(make_certificate()).pages[0]) # Page 4: acknowledgements (redrawn with bold Dr. names) writer.add_page(PdfReader(make_acknowledgements()).pages[0]) # Page 5 onwards: skip src indices 0,1,2,3 → start from 4 for i in range(4, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v5.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print('=== PAGE 4 (Acknowledgements) ===') print(pdf.pages[3].extract_text()) print('\\n=== PAGE 5 check ===') print(pdf.pages[4].extract_text()[:300]) "
Precocious Puberty Thesis Final
PDF Document · PDF
Please don't bold principal investigator name sariga mg in page 1 should be same as font of coinvestigators
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[0] # Get all chars with font info grouped by text seen = {} for ch in page.chars: txt = ch['text'].strip() font = ch.get('fontname','?') size = round(ch.get('size',0),1) key = (font, size) if key not in seen: seen[key] = [] seen[key].append(txt) for k,v in sorted(seen.items(), key=lambda x: -x[0][1]): sample = ''.join(v[:30]) print(f'font={k[0]} size={k[1]} sample: {sample}') "
Can you do now
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v6.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 L = 2.8*cm; R = W - 2.8*cm; TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" def make_white_header_overlay(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFillColor(colors.white); c.setStrokeColor(colors.white) c.rect(0, H - 45, W, 45, fill=1, stroke=0) c.save(); buf.seek(0) return buf # ── PAGE 1: cover (unchanged) ───────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H - 2.0*cm, R, H - 2.0*cm) c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) y = H - 3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") y -= 0.72*cm c.setFont("Helvetica-Oblique", 11); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8) c.line(L, y, R, y) logo_size = 8.0*cm logo_x = (W - logo_size) / 2 logo_y = (H / 2) - (logo_size / 2) c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') bot = 4.8*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, bot, R, bot) by = bot - 0.75*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine") by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri") by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, by, R, by) c.save(); buf.seek(0) return buf # ── PAGE 2: title page – Sariga M G same font/size as co-investigators ──── def make_title_page(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) # NO header on this page y = H - 3.0*cm # Main title c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") # Subtitle italic y -= 0.70*cm c.setFont("Helvetica-Oblique", 13); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.52*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") # Divider rule y -= 0.45*cm c.setStrokeColor(BLACK); c.setLineWidth(0.8) c.line(L, y, R, y) y -= 0.80*cm # Principal Investigator label (bold 11) c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Principal Investigator:") y -= 0.55*cm # Sariga M G – PLAIN size 10, same as co-investigators c.setFont("Helvetica", 10); c.setFillColor(BLACK) c.drawString(L + 0.5*cm, y, "Sariga M G") y -= 0.45*cm c.drawString(L + 0.5*cm, y, "Third Year MBBS, Government Medical College Manjeri") y -= 0.80*cm # Co-Investigators label (bold 11) c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Co-Investigators:") y -= 0.52*cm # Co-inv names – plain size 10 co_invs = [ "SP Keerthana | Krishna N | Rajkumar Barwal | Sabah Rahman | Nahnu Rinsha P", "Ramgopal K | Rimjhim Merotha | Roshani Kumari Jatav | Shifana M | Shifana Nasrin", "Shinsiya Sherin PP | Sideeque Ali | Suman Meena | Vivek T | Aiswarya T K" ] c.setFont("Helvetica", 10); c.setFillColor(BLACK) for ln in co_invs: c.drawCentredString(W/2, y, ln) y -= 0.45*cm y -= 0.35*cm # thin rule c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.6) c.line(L, y, R, y) y -= 0.75*cm # Guides label c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Guides:") y -= 0.65*cm # Guide 1 c.setFont("Helvetica-Bold", 12); c.setFillColor(DARK_BLUE) c.drawString(L + 0.3*cm, y, "1. Dr. Sabitha Rose Jacob") y -= 0.50*cm c.setFont("Helvetica", 11); c.setFillColor(GREY) c.drawString(L + 0.8*cm, y, "MD Community Medicine, Associate Professor (CAP)") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Department of Community Medicine") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Government Medical College Manjeri") y -= 0.75*cm # Guide 2 c.setFont("Helvetica-Bold", 12); c.setFillColor(DARK_BLUE) c.drawString(L + 0.3*cm, y, "2. Dr. Remiza Rayikkal Answar") y -= 0.50*cm c.setFont("Helvetica", 11); c.setFillColor(GREY) c.drawString(L + 0.8*cm, y, "MD Community Medicine, Assistant Professor") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Department of Community Medicine") y -= 0.45*cm c.drawString(L + 0.8*cm, y, "Government Medical College Manjeri") y -= 0.80*cm # bottom rule c.setStrokeColor(DARK_BLUE); c.setLineWidth(1.2) c.line(L, y, R, y) y -= 0.65*cm # IEC / IRC c.setFont("Helvetica", 10); c.setFillColor(GREY) c.drawCentredString(W/2, y, "IEC Ref. No.: IEC/GMCM/204/2026 | IRC Approval No.: IRC/GMCM/313") c.save(); buf.seek(0) return buf # ── PAGE 3: certificate (unchanged) ────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H - 3.0*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.30*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y) y -= 1.1*cm body = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026." ) style = ParagraphStyle('body', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(TW, 500) p.drawOn(c, L, y - ph) y -= ph + 1.8*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Guided by:") y -= 1.0*cm COL1 = L + 0.5*cm; COL2 = W/2 + 1.0*cm; LG = 0.52*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica", 10.5); c.setFillColor(GREY) c.drawString(COL1 + 0.5*cm, y - LG, "MD Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG, "MD Community Medicine,") c.drawString(COL1 + 0.5*cm, y - LG*2, "Associate Professor (CAP)") c.drawString(COL2 + 0.5*cm, y - LG*2, "Assistant Professor") c.drawString(COL1 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") c.drawString(COL2 + 0.5*cm, y - LG*3, "Dept. of Community Medicine,") c.drawString(COL1 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") c.drawString(COL2 + 0.5*cm, y - LG*4, "Govt. Medical College Manjeri") y_sig = y - LG*4 - 1.4*cm; SIG_LEN = 5.5*cm c.setFont("Helvetica", 11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig + 0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + sw, y_sig, x + sw + SIG_LEN, y_sig) y_date = y_sig - 1.0*cm for x in [COL1, COL2]: c.drawString(x, y_date + 0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x + dw, y_date, x + dw + SIG_LEN, y_date) c.save(); buf.seek(0) return buf # ── PAGE 4: acknowledgements (unchanged) ───────────────────────────────── def make_acknowledgements(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFont("Helvetica", 7.5); c.setFillColor(colors.HexColor("#555555")) c.drawString(L, H - 1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5) c.line(L, H - 1.4*cm, R, H - 1.4*cm) y = H - 2.8*cm c.setFont("Helvetica-Bold", 13); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "ACKNOWLEDGEMENTS") y -= 1.0*cm body_style = ParagraphStyle('ack', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY, spaceAfter=10) paras = [ ("We owe our deepest gratitude to <b>Dr. Priya Chandran</b>, MD, Professor and Head of the " "Department of Community Medicine, Government Medical College Manjeri, whose visionary " "leadership, unwavering encouragement, and magnanimous support made this research endeavour " "possible. Her expert guidance at every stage of the project, her accessibility and willingness " "to help in every way possible, and the academic environment she has fostered in the department " "have been the bedrock upon which this work stands. We are truly fortunate to have had the " "benefit of her mentorship."), ("We sincerely thank our guides, <b>Dr. Sabitha Rose Jacob</b>, MD, Associate Professor (CAP), " "and <b>Dr. Remiza Rayikkal Answar</b>, MD, Assistant Professor, Department of Community " "Medicine, Government Medical College Manjeri, for their meticulous guidance, scholarly input, " "constant motivation, and patient supervision throughout this project."), ("We extend our sincere gratitude to the Principal, Government Medical College Manjeri, for the " "institutional support extended to this research. We are deeply thankful to the Institutional " "Ethics Committee (IEC), Government Medical College Manjeri (Ref. No.: IEC/GMCM/204/2026) " "and the Institutional Research Committee (IRC No.: IRC/GMCM/313) for their timely review and " "approval. We thank the principals, teachers, and management of Benchmark International School " "Manjeri, Government Higher Secondary School (Girls) Manjeri, and Government Higher Secondary " "School Irumbuzhi, Anakkayam, for their wholehearted cooperation in facilitating data collection."), ("Our heartfelt thanks go to all the student participants and their parents/guardians who " "generously gave their time and shared information that forms the foundation of this study. " "Their willingness to contribute to scientific knowledge is greatly appreciated. We also thank " "all co-investigators for their support during data collection. This work was conducted in " "compliance with ICMR Ethical Guidelines for Biomedical Research on Human Participants (2017)."), ] frame = Frame(L, 1.5*cm, TW, y - 1.5*cm, leftPadding=0, rightPadding=0, topPadding=0, bottomPadding=0) frame.addFromList([Paragraph(t, body_style) for t in paras], c) c.setFont("Helvetica", 9); c.setFillColor(GREY) c.drawCentredString(W/2, 1.0*cm, "Page 4") c.save(); buf.seek(0) return buf # ── ASSEMBLE ────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) writer.add_page(PdfReader(make_cover()).pages[0]) # p1 cover writer.add_page(PdfReader(make_title_page()).pages[0]) # p2 title (Sariga plain) writer.add_page(PdfReader(make_certificate()).pages[0]) # p3 certificate writer.add_page(PdfReader(make_acknowledgements()).pages[0]) # p4 ack # skip src indices 0(title),1(decl),2(cert),3(ack) → start from 4 for i in range(4, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v6.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: print('=== PAGE 2 (Title page) ===') print(pdf.pages[1].extract_text()) # Check font of Sariga vs co-inv print('\\n--- Font check ---') page = pdf.pages[1] for ch in page.chars: if ch['text'] in ['S','a','r','i','g']: txt_block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if 'Sarig' in txt_block: print(f'Sariga font: {ch[\"fontname\"]} size: {ch[\"size\"]}') break for ch in page.chars: if ch['text'] == 'S': txt_block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if 'SP Kee' in txt_block or 'SP' in txt_block: print(f'Co-inv font: {ch[\"fontname\"]} size: {ch[\"size\"]}') break "
make_title_page function used Helvetica size 10 for the name but reportlab must have picked up the wrong font. Let me check and fix:python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[1] # print all unique font+size combos with sample text from collections import defaultdict groups = defaultdict(list) for ch in page.chars: key = (ch.get('fontname','?'), round(ch.get('size',0),1)) groups[key].append(ch['text']) for k in sorted(groups, key=lambda x: -x[1]): sample = ''.join(groups[k][:40]) print(f'font={k[0]} size={k[1]} => {sample}') "
Precocious Puberty Thesis Final
PDF Document · PDF
Don't change style of page 1 from orginal file just make it less bold for sariga m g
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[0] # Find exact coordinates of 'Sariga M G' chars for ch in page.chars: if ch['text'] in ['S','a','r','i','g']: block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if block.startswith('Sariga'): print(f'First char of Sariga: x0={ch[\"x0\"]:.2f} y0={ch[\"y0\"]:.2f} top={ch[\"top\"]:.2f} bottom={ch[\"bottom\"]:.2f}') break # Find bounding box of entire 'Sariga M G' word group sariga_chars = [] in_sariga = False for ch in page.chars: if ch['text'] == 'S': block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if block.startswith('Sariga'): in_sariga = True if in_sariga: sariga_chars.append(ch) if len(sariga_chars) >= 10: # 'Sariga M G' is 10 chars break if sariga_chars: x0 = min(c['x0'] for c in sariga_chars) x1 = max(c['x1'] for c in sariga_chars) y0 = min(c['y0'] for c in sariga_chars) y1 = max(c['y1'] for c in sariga_chars) top = min(c['top'] for c in sariga_chars) bot = max(c['bottom'] for c in sariga_chars) print(f'Sariga M G bbox: x0={x0:.2f} x1={x1:.2f} y0={y0:.2f} y1={y1:.2f}') print(f' top={top:.2f} bottom={bot:.2f}') print(f' font={sariga_chars[0][\"fontname\"]} size={sariga_chars[0][\"size\"]}') # pdfplumber y coords: y0 from bottom of page, top from top of page # page height print(f' page height={page.height:.2f}') # PDF canvas coords: y from bottom = page.height - top print(f' canvas y_bottom={page.height - bot:.2f}') print(f' canvas y_top={page.height - top:.2f}') # full text of these chars print(f' text={repr(\"\".join(c[\"text\"] for c in sariga_chars))}') "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v7.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 # 595.28 x 841.89 pts (matches source page height 792? no - source is 792) # Source page is 792 pts tall (letter-like). Work in source coords. SRC_H = 792.0 L = 2.8*cm; R = W - 2.8*cm; TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" # ── Overlay: white box over header strip (top 45 pts) + white box over # "Sariga M G" then redraw in plain font, all in source page coordinates ── def make_title_overlay(): """Single overlay page (same size as source: 595x792) that: 1. Whites out the header strip 2. Whites out 'Sariga M G' and redraws it plain """ from reportlab.lib.pagesizes import letter # source page size PAGE_W = 595.28 PAGE_H = 792.0 buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=(PAGE_W, PAGE_H)) # 1. White out header strip (top ~45 pts) c.setFillColor(colors.white); c.setStrokeColor(colors.white) c.rect(0, PAGE_H - 45, PAGE_W, 46, fill=1, stroke=0) # 2. White out 'Sariga M G' bounding box (add padding) # pdfplumber coords: y0=504.36 (from bottom), y1=517.36 # add a little padding: x -2, y -2, +4 each side sx0, sy0, sx1, sy1 = 281.15, 504.36, 348.97, 517.36 pad = 2 c.rect(sx0 - pad, sy0 - pad, (sx1 - sx0) + pad*2, (sy1 - sy0) + pad*2, fill=1, stroke=0) # 3. Redraw 'Sariga M G' in plain (non-bold) at same position, same size 13 # Use LiberationSans approximated by Helvetica (same metrics) c.setFillColor(colors.black) c.setFont("Helvetica", 13) # draw at x0, baseline = sy0 (pdfplumber y0 is baseline in PDF coords) c.drawString(sx0, sy0, "Sariga M G") c.save(); buf.seek(0) return buf # ── Cover page (unchanged) ──────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H - 2.0*cm, R, H - 2.0*cm) c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) y = H - 3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY") y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS") y -= 0.72*cm c.setFont("Helvetica-Oblique", 11); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,") y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India") y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8) c.line(L, y, R, y) logo_size = 8.0*cm logo_x = (W - logo_size) / 2 logo_y = (H / 2) - (logo_size / 2) c.drawImage(LOGO_PATH, logo_x, logo_y, width=logo_size, height=logo_size, preserveAspectRatio=True, mask='auto') bot = 4.8*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, bot, R, bot) by = bot - 0.75*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine") by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri") by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, by, R, by) c.save(); buf.seek(0) return buf # ── Certificate (unchanged) ─────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H - 3.0*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE") y -= 0.30*cm tw = c.stringWidth("CERTIFICATE", "Helvetica-Bold", 14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y) y -= 1.1*cm body = ( "This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026." ) style = ParagraphStyle('body', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style) pw, ph = p.wrap(TW, 500) p.drawOn(c, L, y - ph) y -= ph + 1.8*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(BLACK) c.drawString(L, y, "Guided by:") y -= 1.0*cm COL1 = L + 0.5*cm; COL2 = W/2 + 1.0*cm; LG = 0.52*cm c.setFont("Helvetica-Bold", 11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica", 10.5); c.setFillColor(GREY) c.drawString(COL1+0.5*cm, y-LG, "MD Community Medicine,") c.drawString(COL2+0.5*cm, y-LG, "MD Community Medicine,") c.drawString(COL1+0.5*cm, y-LG*2, "Associate Professor (CAP)") c.drawString(COL2+0.5*cm, y-LG*2, "Assistant Professor") c.drawString(COL1+0.5*cm, y-LG*3, "Dept. of Community Medicine,") c.drawString(COL2+0.5*cm, y-LG*3, "Dept. of Community Medicine,") c.drawString(COL1+0.5*cm, y-LG*4, "Govt. Medical College Manjeri") c.drawString(COL2+0.5*cm, y-LG*4, "Govt. Medical College Manjeri") y_sig = y - LG*4 - 1.4*cm; SIG_LEN = 5.5*cm c.setFont("Helvetica", 11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig+0.18*cm, "Signature: ") sw = c.stringWidth("Signature: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x+sw, y_sig, x+sw+SIG_LEN, y_sig) y_date = y_sig - 1.0*cm for x in [COL1, COL2]: c.drawString(x, y_date+0.18*cm, "Date: ") dw = c.stringWidth("Date: ", "Helvetica", 11) c.setStrokeColor(BLACK); c.setLineWidth(0.7) c.line(x+dw, y_date, x+dw+SIG_LEN, y_date) c.save(); buf.seek(0) return buf # ── Acknowledgements (unchanged) ───────────────────────────────────────── def make_acknowledgements(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFont("Helvetica", 7.5); c.setFillColor(colors.HexColor("#555555")) c.drawString(L, H-1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5) c.line(L, H-1.4*cm, R, H-1.4*cm) y = H - 2.8*cm c.setFont("Helvetica-Bold", 13); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "ACKNOWLEDGEMENTS") y -= 1.0*cm bs = ParagraphStyle('ack', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY, spaceAfter=10) paras = [ ("We owe our deepest gratitude to <b>Dr. Priya Chandran</b>, MD, Professor and Head of the " "Department of Community Medicine, Government Medical College Manjeri, whose visionary " "leadership, unwavering encouragement, and magnanimous support made this research endeavour " "possible. Her expert guidance at every stage of the project, her accessibility and willingness " "to help in every way possible, and the academic environment she has fostered in the department " "have been the bedrock upon which this work stands. We are truly fortunate to have had the " "benefit of her mentorship."), ("We sincerely thank our guides, <b>Dr. Sabitha Rose Jacob</b>, MD, Associate Professor (CAP), " "and <b>Dr. Remiza Rayikkal Answar</b>, MD, Assistant Professor, Department of Community " "Medicine, Government Medical College Manjeri, for their meticulous guidance, scholarly input, " "constant motivation, and patient supervision throughout this project."), ("We extend our sincere gratitude to the Principal, Government Medical College Manjeri, for the " "institutional support extended to this research. We are deeply thankful to the Institutional " "Ethics Committee (IEC), Government Medical College Manjeri (Ref. No.: IEC/GMCM/204/2026) " "and the Institutional Research Committee (IRC No.: IRC/GMCM/313) for their timely review and " "approval. We thank the principals, teachers, and management of Benchmark International School " "Manjeri, Government Higher Secondary School (Girls) Manjeri, and Government Higher Secondary " "School Irumbuzhi, Anakkayam, for their wholehearted cooperation in facilitating data collection."), ("Our heartfelt thanks go to all the student participants and their parents/guardians who " "generously gave their time and shared information that forms the foundation of this study. " "Their willingness to contribute to scientific knowledge is greatly appreciated. We also thank " "all co-investigators for their support during data collection. This work was conducted in " "compliance with ICMR Ethical Guidelines for Biomedical Research on Human Participants (2017)."), ] frame = Frame(L, 1.5*cm, TW, y-1.5*cm, leftPadding=0, rightPadding=0, topPadding=0, bottomPadding=0) frame.addFromList([Paragraph(t, bs) for t in paras], c) c.setFont("Helvetica", 9); c.setFillColor(GREY) c.drawCentredString(W/2, 1.0*cm, "Page 4") c.save(); buf.seek(0) return buf # ── ASSEMBLE ────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) # Page 1: cover writer.add_page(PdfReader(make_cover()).pages[0]) # Page 2: original title page (index 0) with targeted overlay orig_p1 = src.pages[0] overlay = PdfReader(make_title_overlay()).pages[0] orig_p1.merge_page(overlay) writer.add_page(orig_p1) # Page 3: certificate writer.add_page(PdfReader(make_certificate()).pages[0]) # Page 4: acknowledgements writer.add_page(PdfReader(make_acknowledgements()).pages[0]) # Remaining: skip src 0,1,2,3 → start from 4 for i in range(4, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v7.py
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[1] from collections import defaultdict groups = defaultdict(list) for ch in page.chars: key = (ch.get('fontname','?'), round(ch.get('size',0),1)) groups[key].append(ch['text']) for k in sorted(groups, key=lambda x: -x[1]): sample = ''.join(groups[k][:40]) print(f'font={k[0]} size={k[1]} => {sample}') "
Helvetica size 13 "Sariga M G" drawn on top. The plain version renders on top visually. All other original text (titles, co-investigators, guides, rules, dividers) is completely untouched from the original file.Precocious Puberty Thesis Final
PDF Document · PDF
Make sariga m g smaller font size as sp Keerthana don't enlarge
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[0] # Get exact x0, y0 of 'Sariga M G' and also 'Third Year MBBS' line below it for ch in page.chars: block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if block.startswith('Sariga'): print(f'Sariga start: x0={ch[\"x0\"]:.2f} y0={ch[\"y0\"]:.2f} y1={ch[\"y1\"]:.2f} size={ch[\"size\"]}') break # Also find 'Third Year MBBS' coords to know the gap for ch in page.chars: block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if block.startswith('Third Ye'): print(f'Third Year start: x0={ch[\"x0\"]:.2f} y0={ch[\"y0\"]:.2f} y1={ch[\"y1\"]:.2f} size={ch[\"size\"]}') break # SP Keerthana coords for ch in page.chars: block = ''.join(c['text'] for c in page.chars[page.chars.index(ch):page.chars.index(ch)+10]) if block.startswith('SP Keer'): print(f'SP Keerthana start: x0={ch[\"x0\"]:.2f} y0={ch[\"y0\"]:.2f} size={ch[\"size\"]}') break "
cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v8.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 L = 2.8*cm; R = W - 2.8*cm; TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" # ── Overlay for title page ──────────────────────────────────────────────── def make_title_overlay(): PAGE_W, PAGE_H = 595.28, 792.0 buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=(PAGE_W, PAGE_H)) # 1. White out header strip c.setFillColor(colors.white); c.setStrokeColor(colors.white) c.rect(0, PAGE_H - 45, PAGE_W, 46, fill=1, stroke=0) # 2. White out original bold "Sariga M G" (size 13, x0=281.15 y0=504.36 y1=517.36) # Make box wider to fully cover the bold text + add generous padding sx0, sy0, sx1, sy1 = 281.15, 504.36, 355.0, 517.36 pad = 3 c.rect(sx0 - pad, sy0 - pad, (sx1 - sx0) + pad*2 + 20, (sy1 - sy0) + pad*2, fill=1, stroke=0) # 3. Redraw "Sariga M G" plain, size 10 (same as SP Keerthana) # Keep x0 the same (left-aligned under Principal Investigator label) # Baseline: size-10 text, place so it sits in same vertical region c.setFillColor(colors.black) c.setFont("Helvetica", 10) # y0=504.36 was baseline of size-13 text; keep same x, nudge y up slightly # so size-10 text sits centred in the same row (diff of 3pts / 2 = 1.5) c.drawString(sx0, sy0 + 1.5, "Sariga M G") c.save(); buf.seek(0) return buf # ── Cover (unchanged) ───────────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H-2.0*cm, R, H-2.0*cm) c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) y = H-3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY"); y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS"); y -= 0.72*cm c.setFont("Helvetica-Oblique", 11); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,"); y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India"); y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8); c.line(L, y, R, y) ls = 8.0*cm; lx = (W-ls)/2; ly = (H/2)-(ls/2) c.drawImage(LOGO_PATH, lx, ly, width=ls, height=ls, preserveAspectRatio=True, mask='auto') bot = 4.8*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5); c.line(L, bot, R, bot) by = bot-0.75*cm; c.setFont("Helvetica-Bold", 14); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine"); by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri"); by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5); c.line(L, by, R, by) c.save(); buf.seek(0); return buf # ── Certificate (unchanged) ─────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H-3.0*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE"); y -= 0.30*cm tw = c.stringWidth("CERTIFICATE","Helvetica-Bold",14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y); y -= 1.1*cm body = ("This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026.") style = ParagraphStyle('b', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style); pw, ph = p.wrap(TW, 500); p.drawOn(c, L, y-ph); y -= ph+1.8*cm c.setFont("Helvetica-Bold",11); c.setFillColor(BLACK); c.drawString(L, y, "Guided by:"); y -= 1.0*cm COL1=L+0.5*cm; COL2=W/2+1.0*cm; LG=0.52*cm c.setFont("Helvetica-Bold",11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica",10.5); c.setFillColor(GREY) for row, t1, t2 in [(1,"MD Community Medicine,","MD Community Medicine,"), (2,"Associate Professor (CAP)","Assistant Professor"), (3,"Dept. of Community Medicine,","Dept. of Community Medicine,"), (4,"Govt. Medical College Manjeri","Govt. Medical College Manjeri")]: c.drawString(COL1+0.5*cm, y-LG*row, t1) c.drawString(COL2+0.5*cm, y-LG*row, t2) y_sig=y-LG*4-1.4*cm; SIG=5.5*cm c.setFont("Helvetica",11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig+0.18*cm, "Signature: ") sw=c.stringWidth("Signature: ","Helvetica",11) c.setStrokeColor(BLACK); c.setLineWidth(0.7); c.line(x+sw, y_sig, x+sw+SIG, y_sig) y_d=y_sig-1.0*cm for x in [COL1, COL2]: c.drawString(x, y_d+0.18*cm, "Date: ") dw=c.stringWidth("Date: ","Helvetica",11) c.setStrokeColor(BLACK); c.setLineWidth(0.7); c.line(x+dw, y_d, x+dw+SIG, y_d) c.save(); buf.seek(0); return buf # ── Acknowledgements (unchanged) ───────────────────────────────────────── def make_acknowledgements(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFont("Helvetica",7.5); c.setFillColor(colors.HexColor("#555555")) c.drawString(L, H-1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5); c.line(L, H-1.4*cm, R, H-1.4*cm) y = H-2.8*cm; c.setFont("Helvetica-Bold",13); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "ACKNOWLEDGEMENTS"); y -= 1.0*cm bs = ParagraphStyle('ack', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY, spaceAfter=10) paras = [ "We owe our deepest gratitude to <b>Dr. Priya Chandran</b>, MD, Professor and Head of the Department of Community Medicine, Government Medical College Manjeri, whose visionary leadership, unwavering encouragement, and magnanimous support made this research endeavour possible. Her expert guidance at every stage of the project, her accessibility and willingness to help in every way possible, and the academic environment she has fostered in the department have been the bedrock upon which this work stands. We are truly fortunate to have had the benefit of her mentorship.", "We sincerely thank our guides, <b>Dr. Sabitha Rose Jacob</b>, MD, Associate Professor (CAP), and <b>Dr. Remiza Rayikkal Answar</b>, MD, Assistant Professor, Department of Community Medicine, Government Medical College Manjeri, for their meticulous guidance, scholarly input, constant motivation, and patient supervision throughout this project.", "We extend our sincere gratitude to the Principal, Government Medical College Manjeri, for the institutional support extended to this research. We are deeply thankful to the Institutional Ethics Committee (IEC), Government Medical College Manjeri (Ref. No.: IEC/GMCM/204/2026) and the Institutional Research Committee (IRC No.: IRC/GMCM/313) for their timely review and approval. We thank the principals, teachers, and management of Benchmark International School Manjeri, Government Higher Secondary School (Girls) Manjeri, and Government Higher Secondary School Irumbuzhi, Anakkayam, for their wholehearted cooperation in facilitating data collection.", "Our heartfelt thanks go to all the student participants and their parents/guardians who generously gave their time and shared information that forms the foundation of this study. Their willingness to contribute to scientific knowledge is greatly appreciated. We also thank all co-investigators for their support during data collection. This work was conducted in compliance with ICMR Ethical Guidelines for Biomedical Research on Human Participants (2017).", ] frame = Frame(L, 1.5*cm, TW, y-1.5*cm, leftPadding=0, rightPadding=0, topPadding=0, bottomPadding=0) frame.addFromList([Paragraph(t, bs) for t in paras], c) c.setFont("Helvetica",9); c.setFillColor(GREY); c.drawCentredString(W/2, 1.0*cm, "Page 4") c.save(); buf.seek(0); return buf # ── ASSEMBLE ────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) writer.add_page(PdfReader(make_cover()).pages[0]) orig_p1 = src.pages[0] orig_p1.merge_page(PdfReader(make_title_overlay()).pages[0]) writer.add_page(orig_p1) writer.add_page(PdfReader(make_certificate()).pages[0]) writer.add_page(PdfReader(make_acknowledgements()).pages[0]) for i in range(4, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v8.py
python3 -c " import pdfplumber from collections import defaultdict pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[1] groups = defaultdict(list) for ch in page.chars: key = (ch.get('fontname','?'), round(ch.get('size',0),1)) groups[key].append(ch['text']) for k in sorted(groups, key=lambda x: -x[1]): sample = ''.join(groups[k][:35]) print(f'font={k[0]} size={k[1]} => {sample}') "
Precocious Puberty Thesis Final
PDF Document · PDF
Coinvestigator names should blend with colour and format of sariga m g
python3 -c " import pdfplumber pdf_path = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[0] # Find all 3 co-inv lines - get bbox of each line # Co-inv chars are size 10, font LiberationSans co_chars = [ch for ch in page.chars if round(ch.get('size',0),1)==10.0] # Group into lines by y0 value (round to nearest 2pts) lines = {} for ch in co_chars: y_key = round(ch['y0']/2)*2 if y_key not in lines: lines[y_key] = [] lines[y_key].append(ch) for y_key in sorted(lines.keys(), reverse=True): chars = lines[y_key] text = ''.join(c['text'] for c in chars) x0 = min(c['x0'] for c in chars) x1 = max(c['x1'] for c in chars) y0 = min(c['y0'] for c in chars) y1 = max(c['y1'] for c in chars) print(f'y0={y0:.2f} y1={y1:.2f} x0={x0:.2f} x1={x1:.2f} => {text[:80]}') "
LiberationSans (from the original PDF) while "Sariga M G" is now Helvetica black. I need to white-out all three co-inv lines and redraw them in Helvetica size 10 black to match.cat << 'PYEOF' > /tmp/workspace/precocious_puberty/build_v9.py import io, os from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.pdfgen import canvas from reportlab.platypus import Paragraph, Frame from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_JUSTIFY from pypdf import PdfWriter, PdfReader PDF_SRC = '/tmp/workspace/attachments/f4a2dd53-3e6d-4699-997d-2fdb3580c9f3/Precocious_Puberty_Thesis_Malappuram_2024 (4) (1).pdf' LOGO_PATH = '/tmp/workspace/precocious_puberty/logo.png' OUT_PATH = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' W, H = A4 L = 2.8*cm; R = W - 2.8*cm; TW = R - L DARK_BLUE = colors.HexColor("#1B3A6B") RULE_LIGHT = colors.HexColor("#AABDD4") BLACK = colors.HexColor("#111111") GREY = colors.HexColor("#555555") HEADER_TEXT = "Prevalence of Precocious Puberty Among School Girls – Government Medical College Manjeri" def make_title_overlay(): PAGE_W, PAGE_H = 595.28, 792.0 buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=(PAGE_W, PAGE_H)) c.setFillColor(colors.white); c.setStrokeColor(colors.white) # 1. White out header strip c.rect(0, PAGE_H - 45, PAGE_W, 46, fill=1, stroke=0) # 2. White out "Sariga M G" (original bold size-13) c.rect(278, 502, 85, 18, fill=1, stroke=0) # 3. White out all 3 co-investigator lines (original LiberationSans size-10) # Line 1: y0=454.49 y1=464.49 x0=125.40 x1=504.48 c.rect(122, 452, 387, 15, fill=1, stroke=0) # Line 2: y0=440.99 y1=450.99 x0=118.20 x1=511.69 c.rect(115, 439, 401, 15, fill=1, stroke=0) # Line 3: y0=427.49 y1=437.49 x0=138.20 x1=491.74 c.rect(135, 425, 362, 15, fill=1, stroke=0) # 4. Redraw "Sariga M G" — Helvetica plain, size 10, black c.setFillColor(colors.black) c.setFont("Helvetica", 10) c.drawString(281.15, 505.5, "Sariga M G") # 5. Redraw co-investigator lines — Helvetica plain, size 10, black # Centre each line (matching original centred layout) co_lines = [ "SP Keerthana | Krishna N | Rajkumar Barwal | Sabah Rahman | Nahnu Rinsha P", "Ramgopal K | Rimjhim Merotha | Roshani Kumari Jatav | Shifana M | Shifana Nasrin", "Shinsiya Sherin PP | Sideeque Ali | Suman Meena | Vivek T | Aiswarya T K" ] c.setFont("Helvetica", 10) # y0 baselines from pdfplumber (these are PDF y coords = bottom of glyph) y_positions = [454.49, 440.99, 427.49] for line, y_base in zip(co_lines, y_positions): tw = c.stringWidth(line, "Helvetica", 10) x_start = (PAGE_W - tw) / 2 # centre on page c.drawString(x_start, y_base, line) c.save(); buf.seek(0) return buf # ── Cover (unchanged) ───────────────────────────────────────────────────── def make_cover(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5) c.line(L, H-2.0*cm, R, H-2.0*cm) c.setFont("Helvetica-Bold", 22); c.setFillColor(DARK_BLUE) y = H-3.1*cm c.drawCentredString(W/2, y, "PREVALENCE OF PRECOCIOUS PUBERTY"); y -= 0.85*cm c.drawCentredString(W/2, y, "AMONG SCHOOL GIRLS"); y -= 0.72*cm c.setFont("Helvetica-Oblique", 11); c.setFillColor(GREY) c.drawCentredString(W/2, y, "A Cross-Sectional Study in Manjeri and Anakkayam,"); y -= 0.48*cm c.drawCentredString(W/2, y, "Malappuram District, Kerala, India"); y -= 0.38*cm c.setStrokeColor(RULE_LIGHT); c.setLineWidth(0.8); c.line(L, y, R, y) ls = 8.0*cm; lx = (W-ls)/2; ly = (H/2)-(ls/2) c.drawImage(LOGO_PATH, lx, ly, width=ls, height=ls, preserveAspectRatio=True, mask='auto') bot = 4.8*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5); c.line(L, bot, R, bot) by = bot-0.75*cm; c.setFont("Helvetica-Bold", 14); c.setFillColor(DARK_BLUE) c.drawCentredString(W/2, by, "Department of Community Medicine"); by -= 0.68*cm c.drawCentredString(W/2, by, "Government Medical College Manjeri"); by -= 0.60*cm c.setStrokeColor(DARK_BLUE); c.setLineWidth(2.5); c.line(L, by, R, by) c.save(); buf.seek(0); return buf # ── Certificate (unchanged) ─────────────────────────────────────────────── def make_certificate(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) y = H-3.0*cm c.setFont("Helvetica-Bold", 14); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "CERTIFICATE"); y -= 0.30*cm tw = c.stringWidth("CERTIFICATE","Helvetica-Bold",14) c.setStrokeColor(BLACK); c.setLineWidth(1.2) c.line((W-tw)/2, y, (W+tw)/2, y); y -= 1.1*cm body = ("This is to certify that the project titled \u201cPrevalence of Precocious Puberty " "Among School Girls\u201d is a bona fide record of work submitted by Sariga M G " "and Co-Investigators (SP Keerthana, Krishna N, Rajkumar Barwal, Sabah Rahman, " "Nahnu Rinsha P, Ramgopal K, Rimjhim Merotha, Roshani Kumari Jatav, Shifana M, " "Shifana Nasrin, Shinsiya Sherin PP, Sideeque Ali, Suman Meena, Vivek T, Aiswarya T K) " "of 2023 MBBS Batch to the Department of Community Medicine, Government Medical " "College Manjeri, during the academic year 2025\u20132026.") style = ParagraphStyle('b', fontName='Helvetica', fontSize=11, leading=19, alignment=TA_JUSTIFY) p = Paragraph(body, style); pw, ph = p.wrap(TW, 500); p.drawOn(c, L, y-ph); y -= ph+1.8*cm c.setFont("Helvetica-Bold",11); c.setFillColor(BLACK); c.drawString(L, y, "Guided by:"); y -= 1.0*cm COL1=L+0.5*cm; COL2=W/2+1.0*cm; LG=0.52*cm c.setFont("Helvetica-Bold",11); c.setFillColor(DARK_BLUE) c.drawString(COL1, y, "1. Dr. Sabitha Rose Jacob") c.drawString(COL2, y, "2. Dr. Remiza Rayikkal Answar") c.setFont("Helvetica",10.5); c.setFillColor(GREY) for row, t1, t2 in [(1,"MD Community Medicine,","MD Community Medicine,"), (2,"Associate Professor (CAP)","Assistant Professor"), (3,"Dept. of Community Medicine,","Dept. of Community Medicine,"), (4,"Govt. Medical College Manjeri","Govt. Medical College Manjeri")]: c.drawString(COL1+0.5*cm, y-LG*row, t1); c.drawString(COL2+0.5*cm, y-LG*row, t2) y_sig=y-LG*4-1.4*cm; SIG=5.5*cm c.setFont("Helvetica",11); c.setFillColor(BLACK) for x in [COL1, COL2]: c.drawString(x, y_sig+0.18*cm, "Signature: ") sw=c.stringWidth("Signature: ","Helvetica",11) c.setStrokeColor(BLACK); c.setLineWidth(0.7); c.line(x+sw, y_sig, x+sw+SIG, y_sig) y_d=y_sig-1.0*cm for x in [COL1, COL2]: c.drawString(x, y_d+0.18*cm, "Date: ") dw=c.stringWidth("Date: ","Helvetica",11) c.setStrokeColor(BLACK); c.setLineWidth(0.7); c.line(x+dw, y_d, x+dw+SIG, y_d) c.save(); buf.seek(0); return buf # ── Acknowledgements (unchanged) ───────────────────────────────────────── def make_acknowledgements(): buf = io.BytesIO() c = canvas.Canvas(buf, pagesize=A4) c.setFont("Helvetica",7.5); c.setFillColor(colors.HexColor("#555555")) c.drawString(L, H-1.2*cm, HEADER_TEXT) c.setStrokeColor(colors.HexColor("#cccccc")); c.setLineWidth(0.5); c.line(L, H-1.4*cm, R, H-1.4*cm) y = H-2.8*cm; c.setFont("Helvetica-Bold",13); c.setFillColor(BLACK) c.drawCentredString(W/2, y, "ACKNOWLEDGEMENTS"); y -= 1.0*cm bs = ParagraphStyle('ack', fontName='Helvetica', fontSize=11, leading=18, alignment=TA_JUSTIFY, spaceAfter=10) paras = [ "We owe our deepest gratitude to <b>Dr. Priya Chandran</b>, MD, Professor and Head of the Department of Community Medicine, Government Medical College Manjeri, whose visionary leadership, unwavering encouragement, and magnanimous support made this research endeavour possible. Her expert guidance at every stage of the project, her accessibility and willingness to help in every way possible, and the academic environment she has fostered in the department have been the bedrock upon which this work stands. We are truly fortunate to have had the benefit of her mentorship.", "We sincerely thank our guides, <b>Dr. Sabitha Rose Jacob</b>, MD, Associate Professor (CAP), and <b>Dr. Remiza Rayikkal Answar</b>, MD, Assistant Professor, Department of Community Medicine, Government Medical College Manjeri, for their meticulous guidance, scholarly input, constant motivation, and patient supervision throughout this project.", "We extend our sincere gratitude to the Principal, Government Medical College Manjeri, for the institutional support extended to this research. We are deeply thankful to the Institutional Ethics Committee (IEC), Government Medical College Manjeri (Ref. No.: IEC/GMCM/204/2026) and the Institutional Research Committee (IRC No.: IRC/GMCM/313) for their timely review and approval. We thank the principals, teachers, and management of Benchmark International School Manjeri, Government Higher Secondary School (Girls) Manjeri, and Government Higher Secondary School Irumbuzhi, Anakkayam, for their wholehearted cooperation in facilitating data collection.", "Our heartfelt thanks go to all the student participants and their parents/guardians who generously gave their time and shared information that forms the foundation of this study. Their willingness to contribute to scientific knowledge is greatly appreciated. We also thank all co-investigators for their support during data collection. This work was conducted in compliance with ICMR Ethical Guidelines for Biomedical Research on Human Participants (2017).", ] frame = Frame(L, 1.5*cm, TW, y-1.5*cm, leftPadding=0, rightPadding=0, topPadding=0, bottomPadding=0) frame.addFromList([Paragraph(t, bs) for t in paras], c) c.setFont("Helvetica",9); c.setFillColor(GREY); c.drawCentredString(W/2, 1.0*cm, "Page 4") c.save(); buf.seek(0); return buf # ── ASSEMBLE ────────────────────────────────────────────────────────────── writer = PdfWriter() src = PdfReader(PDF_SRC) writer.add_page(PdfReader(make_cover()).pages[0]) orig_p1 = src.pages[0] orig_p1.merge_page(PdfReader(make_title_overlay()).pages[0]) writer.add_page(orig_p1) writer.add_page(PdfReader(make_certificate()).pages[0]) writer.add_page(PdfReader(make_acknowledgements()).pages[0]) for i in range(4, len(src.pages)): writer.add_page(src.pages[i]) with open(OUT_PATH, 'wb') as f: writer.write(f) print(f"Done — {len(writer.pages)} pages | {os.path.getsize(OUT_PATH)//1024} KB") PYEOF python3 /tmp/workspace/precocious_puberty/build_v9.py
python3 -c " import pdfplumber from collections import defaultdict pdf_path = '/tmp/workspace/precocious_puberty/Precocious_Puberty_Thesis_Final.pdf' with pdfplumber.open(pdf_path) as pdf: page = pdf.pages[1] groups = defaultdict(list) for ch in page.chars: key = (ch.get('fontname','?'), round(ch.get('size',0),1)) groups[key].append(ch['text']) for k in sorted(groups, key=lambda x: -x[1]): sample = ''.join(groups[k][:50]) print(f'font={k[0]} size={k[1]} => {sample[:60]}') "
Precocious Puberty Thesis Final
PDF Document · PDF