Compiled it
Make it in handwritten page
ls /tmp/workspace/ 2>/dev/null && pip show Pillow 2>/dev/null | head -3
mkdir -p /tmp/workspace/handwritten-papers && python3 -c " from PIL import Image, ImageDraw, ImageFont import os # Check available fonts import subprocess result = subprocess.run(['fc-list', '--format=%{file}\n'], capture_output=True, text=True) fonts = result.stdout.strip().split('\n') handwriting_fonts = [f for f in fonts if any(k in f.lower() for k in ['handwrit','cursive','dancing','pacifico','indie','caveat','kalam','patrick','gloria','permanent','shadows','mali','sriracha'])] print('Handwriting fonts:', handwriting_fonts[:10]) print() # Also check common paths import glob ttf_files = glob.glob('/usr/share/fonts/**/*.ttf', recursive=True) ttf_names = [os.path.basename(f) for f in ttf_files] print('Sample TTF files:', ttf_names[:20]) "
pip install --user requests 2>/dev/null | tail -1 # Download a free handwriting font python3 -c " import urllib.request, os # Download Kalam (handwriting font) from Google Fonts CDN url = 'https://github.com/googlefonts/kalam/raw/main/fonts/ttf/Kalam-Regular.ttf' try: urllib.request.urlretrieve(url, '/tmp/workspace/Kalam-Regular.ttf') print('Downloaded Kalam') except Exception as e: print('Error:', e) # Try alternate url2 = 'https://fonts.gstatic.com/s/kalam/v16/YA9dr0Wd4kDdMthROCc.ttf' try: urllib.request.urlretrieve(url2, '/tmp/workspace/Kalam-Regular.ttf') print('Downloaded Kalam from gstatic') except Exception as e2: print('Error2:', e2) "
python3 -c " import urllib.request, os # Try different sources for handwriting fonts urls = [ ('https://fonts.gstatic.com/s/kalam/v16/YA9dr0Wd4kDdMthR.ttf', '/tmp/workspace/Kalam.ttf'), ('https://fonts.gstatic.com/s/caveat/v18/WnznHAc5bAfYB2QRah7pcpNvOx-pjfJ9eIWpZQ.ttf', '/tmp/workspace/Caveat.ttf'), ('https://fonts.gstatic.com/s/patrickhand/v20/LDI1apSQOAYtSuYWp8ZhfYe8XsLgjA.ttf', '/tmp/workspace/PatrickHand.ttf'), ] for url, path in urls: try: urllib.request.urlretrieve(url, path) size = os.path.getsize(path) print(f'Downloaded {os.path.basename(path)}: {size} bytes') except Exception as e: print(f'Failed {os.path.basename(path)}: {e}') "
python3 -c " # Use pip to install a font package or find existing italic/cursive-like fonts import glob, os # List ALL available ttf/otf fonts ttf = glob.glob('/usr/share/fonts/**/*.ttf', recursive=True) otf = glob.glob('/usr/share/fonts/**/*.otf', recursive=True) all_fonts = ttf + otf print('Total fonts:', len(all_fonts)) for f in all_fonts: print(f) "
python3 << 'PYEOF' from PIL import Image, ImageDraw, ImageFont import os, math, random OUT = '/tmp/workspace/handwritten-papers' os.makedirs(OUT, exist_ok=True) # Use italic font for handwriting feel FONT_REGULAR = '/usr/share/fonts/urw-base35/NimbusRoman-Italic.otf' FONT_BOLD = '/usr/share/fonts/urw-base35/NimbusRoman-Bold.otf' FONT_BOLDITA = '/usr/share/fonts/urw-base35/NimbusRoman-BoldItalic.otf' W, H = 1240, 1754 # A4 at 150dpi MARGIN_LEFT = 90 MARGIN_TOP = 80 MARGIN_RIGHT = 80 LINE_COLOR = (180, 200, 220) BG_COLOR = (252, 250, 240) # slight cream INK = (15, 30, 80) # dark blue ink HEADING_INK= (10, 10, 10) def make_font(path, size): try: return ImageFont.truetype(path, size) except: return ImageFont.load_default() def draw_lined_paper(draw, w, h, margin_top=120): line_gap = 36 for y in range(margin_top, h - 60, line_gap): draw.line([(MARGIN_LEFT - 10, y), (w - MARGIN_RIGHT + 10, y)], fill=LINE_COLOR, width=1) # left red margin line draw.line([(MARGIN_LEFT - 30, margin_top), (MARGIN_LEFT - 30, h - 60)], fill=(220, 150, 150), width=2) def wrap_text(text, font, max_width, draw): words = text.split() lines = [] current = '' for word in words: test = (current + ' ' + word).strip() bbox = draw.textbbox((0, 0), test, font=font) if bbox[2] - bbox[0] <= max_width: current = test else: if current: lines.append(current) current = word if current: lines.append(current) return lines def render_page(lines_data, filename, page_num=1, total_pages=1): """ lines_data: list of (text, style, indent) style: 'heading', 'subheading', 'body', 'bold', 'small' """ img = Image.new('RGB', (W, H), BG_COLOR) draw = ImageDraw.Draw(img) # Add very subtle paper texture noise import random random.seed(42) for _ in range(2000): x = random.randint(0, W-1) y = random.randint(0, H-1) v = random.randint(240, 252) img.putpixel((x, y), (v, v, v-5)) draw_lined_paper(draw, W, H, margin_top=130) # Page number bottom right fn_small = make_font(FONT_REGULAR, 22) draw.text((W - 120, H - 50), f'Page {page_num} / {total_pages}', font=fn_small, fill=(150,150,150)) fn_heading = make_font(FONT_BOLDITA, 30) fn_sub = make_font(FONT_BOLDITA, 26) fn_bold = make_font(FONT_BOLD, 25) fn_body = make_font(FONT_REGULAR, 25) fn_small2 = make_font(FONT_REGULAR, 22) y = 90 LINE_H = 36 max_w = W - MARGIN_LEFT - MARGIN_RIGHT for (text, style, indent) in lines_data: if y > H - 80: break x = MARGIN_LEFT + indent if style == 'heading': font = fn_heading color = HEADING_INK dy = LINE_H + 4 elif style == 'subheading': font = fn_sub color = (0, 50, 120) dy = LINE_H + 2 elif style == 'bold': font = fn_bold color = INK dy = LINE_H elif style == 'small': font = fn_small2 color = INK dy = 30 else: font = fn_body color = INK dy = LINE_H if text == '---': draw.line([(MARGIN_LEFT, y+10), (W-MARGIN_RIGHT, y+10)], fill=(100,100,100), width=1) y += 22 continue if text == '': y += 20 continue wrapped = wrap_text(text, font, max_w - indent, draw) for wline in wrapped: if y > H - 80: break # slight random offset for handwritten feel ox = random.randint(-1, 1) oy = random.randint(-1, 1) draw.text((x + ox, y + oy), wline, font=font, fill=color) y += dy img.save(filename, quality=95) print(f'Saved {filename}') # ───────────────────────────────────────────── # PAGE 1: GMERS NAVSARI - PAPER 1 (Section B Q2-Q3) # ───────────────────────────────────────────── p1 = [ ('DEPARTMENT OF ANATOMY', 'heading', 0), ('GMERS MEDICAL COLLEGE, NAVSARI', 'heading', 0), ('1st MBBS Batch 2025-2026 | Preliminary Examination July 2026', 'subheading', 0), ('ANATOMY PAPER - 1', 'subheading', 0), ('Date: 10/07/2025 Time: 09:30 am - 12:30 pm Total Marks: 100', 'small', 0), ('', '', 0), ('Instructions: 1. Write each section in separate answer sheet.', 'small', 0), ('2. Draw neat and labelled diagrams wherever necessary.', 'small', 20), ('3. Figure to the right indicates maximum marks. 4. Write to the point.', 'small', 20), ('---', '', 0), ('SECTION - B', 'subheading', 0), ('', '', 0), ('Q.2 Long Essay Question (Structured) (any one out of two) [1×10 = 10 marks]', 'bold', 0), ('Describe a facial nerve under:', 'body', 0), ('• Functional components', 'body', 30), ('• Course & relations', 'body', 30), ('• Branches & distribution', 'body', 30), ("• Bell's palsy", 'body', 30), ('', '', 0), ('Q.3 Give the Reason of (any 5 out of 6) [5×3 = 15 marks]', 'bold', 0), ('A. A pituitary tumor often causes bitemporal hemianopia', 'body', 20), ('B. Occlusion of PICA leads to dysphagia and hoarseness', 'body', 20), ('C. The median cubital vein is preferred for IV access and venipuncture', 'body', 20), ('D. A mid-shaft fracture of the humerus results in "wrist drop"', 'body', 20), ('E. Severe throat infections can cause pain in the middle ear', 'body', 20), ('F. In a lesion of the right hypoglossal nerve, the protruded tongue', 'body', 20), (' deviates to the right side', 'body', 20), ] render_page(p1, f'{OUT}/page_01_GMERS_P1_SecB_Q2Q3.png', 1, 10) # PAGE 2: GMERS P1 - Q4 + Section C Q5-Q6 p2 = [ ('GMERS MEDICAL COLLEGE, NAVSARI - Anatomy Paper 1 (contd.)', 'subheading', 0), ('---', '', 0), ('Q.4 Write short notes on (any 3 out of 4) [3×5 = 15 marks]', 'bold', 0), ('A. Carotid triangle: boundaries, contents with diagram & applied aspect.', 'body', 20), (' Add a note on carotid sheath.', 'body', 20), ('B. Movements of shoulder joint', 'body', 20), ('C. Serratus anterior muscle. Also write in brief about clavi-pectoral fascia.', 'body', 20), ('D. Histological differences between all types of cartilages', 'body', 20), ('', '', 0), ('---', '', 0), ('SECTION - C', 'subheading', 0), ('', '', 0), ('Q.5 Applied Aspect (attempt all) [4×5 = 20 marks]', 'bold', 0), ('A. Applied anatomy of scalp', 'body', 20), ("B. Klumpke's palsy", 'body', 20), ('C. Cleft palate and Cleft lip', 'body', 20), ('D. Hydrocephalus', 'body', 20), ('', '', 0), ('Q.6 Write short notes on [4×5 = 20 marks]', 'bold', 0), ('A. Anastomosis OR Bursae', 'body', 20), ('B. Chorionic villi', 'body', 20), ('C. Histology of spleen', 'body', 20), ('D. Dissection hall etiquettes', 'body', 20), ] render_page(p2, f'{OUT}/page_02_GMERS_P1_SecC_Q4Q5Q6.png', 2, 10) print('Pages 1-2 done') PYEOF
python3 << 'PYEOF' from PIL import Image, ImageDraw, ImageFont import os, random OUT = '/tmp/workspace/handwritten-papers' FONT_REGULAR = '/usr/share/fonts/urw-base35/NimbusRoman-Italic.otf' FONT_BOLD = '/usr/share/fonts/urw-base35/NimbusRoman-Bold.otf' FONT_BOLDITA = '/usr/share/fonts/urw-base35/NimbusRoman-BoldItalic.otf' W, H = 1240, 1754 MARGIN_LEFT = 90 MARGIN_RIGHT = 80 LINE_COLOR = (180, 200, 220) BG_COLOR = (252, 250, 240) INK = (15, 30, 80) HEADING_INK= (10, 10, 10) def make_font(path, size): try: return ImageFont.truetype(path, size) except: return ImageFont.load_default() def draw_lined_paper(draw, w, h, margin_top=130): line_gap = 36 for y in range(margin_top, h - 60, line_gap): draw.line([(MARGIN_LEFT - 10, y), (w - MARGIN_RIGHT + 10, y)], fill=LINE_COLOR, width=1) draw.line([(MARGIN_LEFT - 30, margin_top), (MARGIN_LEFT - 30, h - 60)], fill=(220, 150, 150), width=2) def wrap_text(text, font, max_width, draw): words = text.split() lines, current = [], '' for word in words: test = (current + ' ' + word).strip() bbox = draw.textbbox((0, 0), test, font=font) if bbox[2] - bbox[0] <= max_width: current = test else: if current: lines.append(current) current = word if current: lines.append(current) return lines def render_page(lines_data, filename, page_num=1, total_pages=10): img = Image.new('RGB', (W, H), BG_COLOR) draw = ImageDraw.Draw(img) random.seed(42 + page_num) for _ in range(2000): x = random.randint(0, W-1); y = random.randint(0, H-1) v = random.randint(240, 252) img.putpixel((x, y), (v, v, v-5)) draw_lined_paper(draw, W, H) fn_small = make_font(FONT_REGULAR, 22) draw.text((W - 130, H - 50), f'Page {page_num} / {total_pages}', font=fn_small, fill=(150,150,150)) fn_h = make_font(FONT_BOLDITA, 30) fn_s = make_font(FONT_BOLDITA, 26) fn_b = make_font(FONT_BOLD, 25) fn_r = make_font(FONT_REGULAR, 25) fn_sm = make_font(FONT_REGULAR, 22) y = 90; LINE_H = 36; max_w = W - MARGIN_LEFT - MARGIN_RIGHT for (text, style, indent) in lines_data: if y > H - 80: break x = MARGIN_LEFT + indent if style == 'heading': font, color, dy = fn_h, HEADING_INK, LINE_H+4 elif style == 'subheading': font, color, dy = fn_s, (0,50,120), LINE_H+2 elif style == 'bold': font, color, dy = fn_b, INK, LINE_H elif style == 'small': font, color, dy = fn_sm, INK, 30 else: font, color, dy = fn_r, INK, LINE_H if text == '---': draw.line([(MARGIN_LEFT, y+10), (W-MARGIN_RIGHT, y+10)], fill=(100,100,100), width=1) y += 22; continue if text == '': y += 20; continue wrapped = wrap_text(text, font, max_w - indent, draw) for wline in wrapped: if y > H - 80: break ox = random.randint(-1,1); oy = random.randint(-1,1) draw.text((x+ox, y+oy), wline, font=font, fill=color) y += dy img.save(filename, quality=95) print(f'Saved {filename}') # PAGE 3: GMERS PAPER 2 - Sec A & B p3 = [ ('DEPARTMENT OF ANATOMY', 'heading', 0), ('GMERS MEDICAL COLLEGE, NAVSARI', 'heading', 0), ('1st MBBS Batch 2025-2026 | Preliminary Examination July 2026', 'subheading', 0), ('ANATOMY PAPER - 2', 'subheading', 0), ('Date: 11/07/2025 Time: 09:30 am - 12:30 pm Total Marks: 100', 'small', 0), ('Instructions: Write each section separately. Draw neat labelled diagrams.', 'small', 0), ('---', '', 0), ('SECTION - A', 'subheading', 0), ('Q.1 MCQ - 20 questions (submit within 30 minutes) [1×1 = 20 marks]', 'bold', 0), ('---', '', 0), ('SECTION - B', 'subheading', 0), ('', '', 0), ('Q.2 Long Essay Question (any one out of two) [1×10 = 10 marks] (1+1+2+2+2+2)', 'bold', 0), ('Describe a knee joint under:', 'body', 0), ('• Type', 'body', 30), ('• Articular surfaces', 'body', 30), ('• Ligaments', 'body', 30), ('• Movements', 'body', 30), ('• Applied anatomy', 'body', 30), ('Add a note on bursae around knee joint with relevant clinical aspects.', 'body', 0), ('', '', 0), ('Q.3 Give the Reason of (any 5 out of 6) [5×3 = 15 marks]', 'bold', 0), ('A. In case of extravasation of urine, it cannot enter into ischio-rectal fossa or thigh', 'body', 20), ('B. Femoral hernia is more common in females', 'body', 20), ('C. Hip joint is more stable than shoulder joint', 'body', 20), ('D. Injury to neck of fibula results in foot drop', 'body', 20), ('E. Carina is considered as the last line of defense in respiratory tract', 'body', 20), ('F. In SVC obstruction before entry of azygous vein, azygous vein becomes the', 'body', 20), (' main channel for venous drainage of upper half of body', 'body', 20), ] render_page(p3, f'{OUT}/page_03_GMERS_P2_SecA_B.png', 3, 10) # PAGE 4: GMERS P2 - Q4 + Section C p4 = [ ('GMERS MEDICAL COLLEGE, NAVSARI - Anatomy Paper 2 (contd.)', 'subheading', 0), ('---', '', 0), ('Q.4 Write short notes on (any 3 out of 4) [3×5 = 15 marks]', 'bold', 0), ('A. Porto-systemic anastomosis', 'body', 20), ('B. Right coronary artery. Explain left coronary dominance.', 'body', 20), ('C. Hamstring muscles', 'body', 20), ('D. Histology of testis', 'body', 20), ('', '', 0), ('---', '', 0), ('SECTION - C', 'subheading', 0), ('', '', 0), ('Q.5 Applied Aspect (attempt all) [4×5 = 20 marks]', 'bold', 0), ('A. Appendicitis', 'body', 20), ('B. Superior gluteal nerve injury', 'body', 20), ('C. Annular pancreas', 'body', 20), ('D. Pleural effusion', 'body', 20), ('', '', 0), ('Q.6 Write short notes on [4×5 = 20 marks]', 'bold', 0), ('A. Y-linked inheritance OR Genetic counselling', 'body', 20), ('B. Aortic arch derivatives', 'body', 20), ('C. Histology of cerebellum', 'body', 20), ('D. Techniques of effective communication skills', 'body', 20), ] render_page(p4, f'{OUT}/page_04_GMERS_P2_SecC.png', 4, 10) print('Pages 3-4 done') PYEOF
python3 << 'PYEOF' from PIL import Image, ImageDraw, ImageFont import os, random OUT = '/tmp/workspace/handwritten-papers' FONT_REGULAR = '/usr/share/fonts/urw-base35/NimbusRoman-Italic.otf' FONT_BOLD = '/usr/share/fonts/urw-base35/NimbusRoman-Bold.otf' FONT_BOLDITA = '/usr/share/fonts/urw-base35/NimbusRoman-BoldItalic.otf' W, H = 1240, 1754 MARGIN_LEFT = 90; MARGIN_RIGHT = 80 LINE_COLOR = (180, 200, 220); BG_COLOR = (252, 250, 240) INK = (15, 30, 80); HEADING_INK = (10, 10, 10) def make_font(path, size): try: return ImageFont.truetype(path, size) except: return ImageFont.load_default() def draw_lined_paper(draw, w, h): for y in range(130, h - 60, 36): draw.line([(MARGIN_LEFT-10, y), (w-MARGIN_RIGHT+10, y)], fill=LINE_COLOR, width=1) draw.line([(MARGIN_LEFT-30, 130), (MARGIN_LEFT-30, h-60)], fill=(220,150,150), width=2) def wrap_text(text, font, max_width, draw): words = text.split(); lines, current = [], '' for word in words: test = (current + ' ' + word).strip() bbox = draw.textbbox((0,0), test, font=font) if bbox[2]-bbox[0] <= max_width: current = test else: if current: lines.append(current) current = word if current: lines.append(current) return lines def render_page(lines_data, filename, page_num=1, total_pages=10): img = Image.new('RGB', (W, H), BG_COLOR) draw = ImageDraw.Draw(img) random.seed(42 + page_num) for _ in range(2000): x=random.randint(0,W-1); y=random.randint(0,H-1); v=random.randint(240,252) img.putpixel((x,y),(v,v,v-5)) draw_lined_paper(draw, W, H) fn_sm2 = make_font(FONT_REGULAR, 22) draw.text((W-130, H-50), f'Page {page_num} / {total_pages}', font=fn_sm2, fill=(150,150,150)) fn_h=make_font(FONT_BOLDITA,30); fn_s=make_font(FONT_BOLDITA,26) fn_b=make_font(FONT_BOLD,25); fn_r=make_font(FONT_REGULAR,25); fn_sm=make_font(FONT_REGULAR,22) y=90; LINE_H=36; max_w=W-MARGIN_LEFT-MARGIN_RIGHT for (text, style, indent) in lines_data: if y>H-80: break x=MARGIN_LEFT+indent if style=='heading': font,color,dy=fn_h,HEADING_INK,LINE_H+4 elif style=='subheading': font,color,dy=fn_s,(0,50,120),LINE_H+2 elif style=='bold': font,color,dy=fn_b,INK,LINE_H elif style=='small': font,color,dy=fn_sm,INK,30 else: font,color,dy=fn_r,INK,LINE_H if text=='---': draw.line([(MARGIN_LEFT,y+10),(W-MARGIN_RIGHT,y+10)],fill=(100,100,100),width=1); y+=22; continue if text=='': y+=20; continue for wline in wrap_text(text,font,max_w-indent,draw): if y>H-80: break draw.text((x+random.randint(-1,1), y+random.randint(-1,1)), wline, font=font, fill=color) y+=dy img.save(filename, quality=95); print(f'Saved {filename}') # PAGE 5: Namo Paper I p5 = [ ('NAMO MEDICAL EDUCATION & RESEARCH INSTITUTE, SILVASSA', 'heading', 0), ('DEPARTMENT OF ANATOMY', 'heading', 0), ('1st Year MBBS Batch 2025-2026 | Preliminary Examination', 'subheading', 0), ('SUBJECT: HUMAN ANATOMY - PAPER I', 'subheading', 0), ('Date: 03/07/2026 Time: 10:00 a.m. Total Marks: 100 Duration: 3 Hrs.', 'small', 0), ('Instructions: Fill roll no./name. Write each section separately. Draw labelled diagrams.', 'small', 0), ('---', '', 0), ('SECTION B [Marks: 40]', 'subheading', 0), ('', '', 0), ('Q.2 Long Essay Question [1×10 = 10 marks]', 'bold', 0), ('Describe in detail the transverse section of midbrain at the level of superior', 'body', 0), ('colliculus. What is the blood supply of midbrain?', 'body', 0), ('Write down the applied importance of Midbrain. (4+3+3)', 'body', 0), ('', '', 0), ('Q.3 Give the Anatomical/Embryological Reason (Any 5) [5×3 = 15 marks]', 'bold', 0), ('1. A 2-year-old child unable to extend tip of tongue beyond the lips.', 'body', 20), (' Most probable diagnosis? Give its embryological basis.', 'body', 20), ('2. A 15-year-old boy with pain in ear, tongue & pharynx; diagnosed with', 'body', 20), (' otitis media. Tongue & pharynx normal. Reason for referred pain?', 'body', 20), ('3. What is Crocodile tears syndrome? Anatomical basis of symptoms?', 'body', 20), ('4. What is Hydrocephalus? Anatomical basis of symptoms seen?', 'body', 20), ('5. Define Claw Hand. Anatomical basis of symptoms.', 'body', 20), ('6. What is Tennis Elbow? Anatomical reason for various symptoms.', 'body', 20), ('', '', 0), ('Q.4 Write Short Note (Any 3) [3×5 = 15 marks]', 'bold', 0), ('1. Maxillary Artery', 'body', 20), ('2. Inlet of Larynx', 'body', 20), ('3. Anastomoses around the Scapula', 'body', 20), ('4. Histology of Spleen', 'body', 20), ] render_page(p5, f'{OUT}/page_05_NAMO_P1_SecB.png', 5, 10) # PAGE 6: Namo Paper I - Section C p6 = [ ('NAMO MEDICAL EDUCATION & RESEARCH INSTITUTE, SILVASSA', 'heading', 0), ('Anatomy Paper I - Section C (contd.)', 'subheading', 0), ('---', '', 0), ('SECTION C [Marks: 40]', 'subheading', 0), ('', '', 0), ('Q.5 Applied Aspect (attempt all) [4×5 = 20 marks]', 'bold', 0), ('1. Applied anatomy of Thyroid Gland', 'body', 20), ('2. Write down the lymphatic drainage of Mammary gland along with its applied anatomy', 'body', 20), ('3. Applied anatomy of Placenta', 'body', 20), ('4. Anencephaly', 'body', 20), ('', '', 0), ('Q.6 Write Short Note [4×5 = 20 marks]', 'bold', 0), ('1. Synovial Joint OR Types of Epiphyses', 'body', 20), ('2. Implantation', 'body', 20), ('3. Histological difference between Skeletal Muscle and Cardiac Muscle', 'body', 20), ('4. Etiquettes to be followed in Dissection Hall', 'body', 20), ] render_page(p6, f'{OUT}/page_06_NAMO_P1_SecC.png', 6, 10) print('Pages 5-6 done') PYEOF
python3 << 'PYEOF' from PIL import Image, ImageDraw, ImageFont import os, random OUT = '/tmp/workspace/handwritten-papers' FONT_REGULAR = '/usr/share/fonts/urw-base35/NimbusRoman-Italic.otf' FONT_BOLD = '/usr/share/fonts/urw-base35/NimbusRoman-Bold.otf' FONT_BOLDITA = '/usr/share/fonts/urw-base35/NimbusRoman-BoldItalic.otf' W, H = 1240, 1754; MARGIN_LEFT=90; MARGIN_RIGHT=80 LINE_COLOR=(180,200,220); BG_COLOR=(252,250,240); INK=(15,30,80); HEADING_INK=(10,10,10) def make_font(path, size): try: return ImageFont.truetype(path, size) except: return ImageFont.load_default() def draw_lined_paper(draw,w,h): for y in range(130,h-60,36): draw.line([(MARGIN_LEFT-10,y),(w-MARGIN_RIGHT+10,y)],fill=LINE_COLOR,width=1) draw.line([(MARGIN_LEFT-30,130),(MARGIN_LEFT-30,h-60)],fill=(220,150,150),width=2) def wrap_text(text,font,max_width,draw): words=text.split(); lines,current=[],'' for word in words: test=(current+' '+word).strip(); bbox=draw.textbbox((0,0),test,font=font) if bbox[2]-bbox[0]<=max_width: current=test else: if current: lines.append(current) current=word if current: lines.append(current) return lines def render_page(lines_data, filename, page_num=1, total_pages=10): img=Image.new('RGB',(W,H),BG_COLOR); draw=ImageDraw.Draw(img) random.seed(42+page_num) for _ in range(2000): x=random.randint(0,W-1); y=random.randint(0,H-1); v=random.randint(240,252) img.putpixel((x,y),(v,v,v-5)) draw_lined_paper(draw,W,H) fn_sm2=make_font(FONT_REGULAR,22) draw.text((W-130,H-50),f'Page {page_num} / {total_pages}',font=fn_sm2,fill=(150,150,150)) fn_h=make_font(FONT_BOLDITA,30); fn_s=make_font(FONT_BOLDITA,26) fn_b=make_font(FONT_BOLD,25); fn_r=make_font(FONT_REGULAR,25); fn_sm=make_font(FONT_REGULAR,22) y=90; LINE_H=36; max_w=W-MARGIN_LEFT-MARGIN_RIGHT for (text,style,indent) in lines_data: if y>H-80: break x=MARGIN_LEFT+indent if style=='heading': font,color,dy=fn_h,HEADING_INK,LINE_H+4 elif style=='subheading':font,color,dy=fn_s,(0,50,120),LINE_H+2 elif style=='bold': font,color,dy=fn_b,INK,LINE_H elif style=='small': font,color,dy=fn_sm,INK,30 else: font,color,dy=fn_r,INK,LINE_H if text=='---': draw.line([(MARGIN_LEFT,y+10),(W-MARGIN_RIGHT,y+10)],fill=(100,100,100),width=1); y+=22; continue if text=='': y+=20; continue for wline in wrap_text(text,font,max_w-indent,draw): if y>H-80: break draw.text((x+random.randint(-1,1),y+random.randint(-1,1)),wline,font=font,fill=color); y+=dy img.save(filename,quality=95); print(f'Saved {filename}') # PAGE 7: Namo Paper II - Section B p7 = [ ('NAMO MEDICAL EDUCATION & RESEARCH INSTITUTE, SILVASSA', 'heading', 0), ('DEPARTMENT OF ANATOMY', 'heading', 0), ('1st Year MBBS Batch 2025-2026 | Preliminary Examination', 'subheading', 0), ('SUBJECT: HUMAN ANATOMY - PAPER II', 'subheading', 0), ('Date: 04/07/2026 Time: 10:00 a.m. Total Marks: 100 Duration: 3 Hrs.', 'small', 0), ('---', '', 0), ('SECTION B [Marks: 40]', 'subheading', 0), ('', '', 0), ('Q.2 Long Essay Question [1×10 = 10 marks]', 'bold', 0), ('Describe the Diaphragm under following headings:', 'body', 0), ('A. Origin and Insertion (2 marks)', 'body', 30), ('B. Openings (4 marks)', 'body', 30), ('C. Nerve supply (2 marks)', 'body', 30), ('D. Applied (2 marks)', 'body', 30), ('', '', 0), ('Q.3 Give the Anatomical/Embryological Reason (Any 5) [5×3 = 15 marks]', 'bold', 0), ('1. What is Automatic reflex bladder? Anatomical basis of symptoms.', 'body', 20), ('2. What is renal colic? Anatomical basis of referred pain in renal colic.', 'body', 20), ('3. A 20-year-old boy after vigorous leg exercise (3 hrs) had severe pain in', 'body', 20), (' lower limbs with swelling in leg compartments. Probable cause &', 'body', 20), (' anatomical reason for symptoms.', 'body', 20), ('4. A 30-year-old professional cyclist with chronic buttock pain, worsened', 'body', 20), (' in last 4-5 days. Probable reason & anatomical base of buttock pain.', 'body', 20), ('5. Pleural tapping - in which intercostal space? Why?', 'body', 20), ('6. What is Coarctation of aorta? Anatomical basis of symptoms.', 'body', 20), ('', '', 0), ('Q.4 Write Short Note (Any 3) [3×5 = 15 marks]', 'bold', 0), ('1. Different types of inguinal hernia and mechanism of inguinal canal', 'body', 20), ('2. Portocaval anastomosis', 'body', 20), ('3. Movements of the Knee Joint', 'body', 20), ('4. Histology of Liver', 'body', 20), ] render_page(p7, f'{OUT}/page_07_NAMO_P2_SecB.png', 7, 10) # PAGE 8: Namo Paper II - Section C p8 = [ ('NAMO MEDICAL EDUCATION & RESEARCH INSTITUTE, SILVASSA', 'heading', 0), ('Anatomy Paper II - Section C (contd.)', 'subheading', 0), ('---', '', 0), ('SECTION C [Marks: 40]', 'subheading', 0), ('', '', 0), ('Q.5 Applied Aspect (attempt all) [4×5 = 20 marks]', 'bold', 0), ('1. Applied anatomy of Kidney', 'body', 20), ('2. Applied anatomy of Arches of Foot', 'body', 20), ('3. Atrial Septal Defect', 'body', 20), ('4. Applied anatomy of Mediastinum', 'body', 20), ('', '', 0), ('Q.6 Write Short Note [4×5 = 20 marks]', 'bold', 0), ('1. Karyotyping OR Turner\'s syndrome', 'body', 20), ('2. Rotation of Midgut', 'body', 20), ('3. Histology of Pancreas', 'body', 20), ('4. Effectiveness of Doctor-Patient Communication', 'body', 20), ] render_page(p8, f'{OUT}/page_08_NAMO_P2_SecC.png', 8, 10) print('Pages 7-8 done') PYEOF
python3 << 'PYEOF' from PIL import Image, ImageDraw, ImageFont import os, random OUT = '/tmp/workspace/handwritten-papers' FONT_REGULAR = '/usr/share/fonts/urw-base35/NimbusRoman-Italic.otf' FONT_BOLD = '/usr/share/fonts/urw-base35/NimbusRoman-Bold.otf' FONT_BOLDITA = '/usr/share/fonts/urw-base35/NimbusRoman-BoldItalic.otf' W,H=1240,1754; MARGIN_LEFT=90; MARGIN_RIGHT=80 LINE_COLOR=(180,200,220); BG_COLOR=(252,250,240); INK=(15,30,80); HEADING_INK=(10,10,10) def make_font(path,size): try: return ImageFont.truetype(path,size) except: return ImageFont.load_default() def draw_lined_paper(draw,w,h): for y in range(130,h-60,36): draw.line([(MARGIN_LEFT-10,y),(w-MARGIN_RIGHT+10,y)],fill=LINE_COLOR,width=1) draw.line([(MARGIN_LEFT-30,130),(MARGIN_LEFT-30,h-60)],fill=(220,150,150),width=2) def wrap_text(text,font,max_width,draw): words=text.split(); lines,current=[],'' for word in words: test=(current+' '+word).strip(); bbox=draw.textbbox((0,0),test,font=font) if bbox[2]-bbox[0]<=max_width: current=test else: if current: lines.append(current) current=word if current: lines.append(current) return lines def render_page(lines_data, filename, page_num=1, total_pages=10): img=Image.new('RGB',(W,H),BG_COLOR); draw=ImageDraw.Draw(img) random.seed(42+page_num) for _ in range(2000): x=random.randint(0,W-1); y=random.randint(0,H-1); v=random.randint(240,252) img.putpixel((x,y),(v,v,v-5)) draw_lined_paper(draw,W,H) fn_sm2=make_font(FONT_REGULAR,22) draw.text((W-130,H-50),f'Page {page_num} / {total_pages}',font=fn_sm2,fill=(150,150,150)) fn_h=make_font(FONT_BOLDITA,30); fn_s=make_font(FONT_BOLDITA,26) fn_b=make_font(FONT_BOLD,25); fn_r=make_font(FONT_REGULAR,25); fn_sm=make_font(FONT_REGULAR,22) y=90; LINE_H=36; max_w=W-MARGIN_LEFT-MARGIN_RIGHT for (text,style,indent) in lines_data: if y>H-80: break x=MARGIN_LEFT+indent if style=='heading': font,color,dy=fn_h,HEADING_INK,LINE_H+4 elif style=='subheading':font,color,dy=fn_s,(0,50,120),LINE_H+2 elif style=='bold': font,color,dy=fn_b,INK,LINE_H elif style=='small': font,color,dy=fn_sm,INK,30 else: font,color,dy=fn_r,INK,LINE_H if text=='---': draw.line([(MARGIN_LEFT,y+10),(W-MARGIN_RIGHT,y+10)],fill=(100,100,100),width=1); y+=22; continue if text=='': y+=20; continue for wline in wrap_text(text,font,max_w-indent,draw): if y>H-80: break draw.text((x+random.randint(-1,1),y+random.randint(-1,1)),wline,font=font,fill=color); y+=dy img.save(filename,quality=95); print(f'Saved {filename}') # PAGE 9: Uterus + Tongue paper (Paper with Uterus Q2) p9 = [ ('ANATOMY - PAPER (Uterus/Tongue Series)', 'heading', 0), ('1st MBBS Batch 2025-2026 | Preliminary Examination', 'subheading', 0), ('---', '', 0), ('SECTION B', 'subheading', 0), ('', '', 0), ('Q.2 Long Essay Question [1×10 = 10 marks]', 'bold', 0), ('A. Describe the Uterus under the following headings:', 'body', 0), (' 1. Enumerate parts of Uterus (1)', 'body', 30), (' 2. Ligaments of Uterus (3)', 'body', 30), (' 3. Supports of Uterus (3)', 'body', 30), (' 4. Blood supply (1)', 'body', 30), (' 5. Applied anatomy (2)', 'body', 30), ('', '', 0), ('Q.3 Give the Reason (5 out of 6) [5×3 = 15 marks]', 'bold', 0), ('A. What is ectopia vesicae? Write its embryological basis.', 'body', 20), ('B. Explain the anatomical basis of varicocele. Which side is varicocele', 'body', 20), (' common on, and why?', 'body', 20), ('C. Justify: The diaphragm acts best as a muscle of respiration in recumbent', 'body', 20), (' supine position.', 'body', 20), ('D. Anatomical basis of sleeping foot.', 'body', 20), ('E. What is positive Trendelenburg\'s sign? Write its anatomical basis.', 'body', 20), ('F. Explain: Bronchopulmonary segments are not bronchovascular segments.', 'body', 20), ('', '', 0), ('Q.4 Write short notes on (3 out of 4) [3×5 = 15 marks]', 'bold', 0), ('A. Ischiorectal fossa', 'body', 20), ('B. Labeled diagram of stomach bed. Blood supply & lymphatic drainage of stomach.', 'body', 20), ('C. Locking and unlocking of knee joint', 'body', 20), ('D. Histology of hyaline cartilage', 'body', 20), ('', '', 0), ('SECTION C', 'subheading', 0), ('Q.5 Applied Aspect [4×5 = 20 marks]', 'bold', 0), ('A. Portocaval anastomosis - common sites; presenting symptoms of portal hypertension', 'body', 20), ('B. Femoral hernia', 'body', 20), ('C. Atrial septal defects', 'body', 20), ("D. Meckel's diverticulum", 'body', 20), ('Q.6 Write short notes on [4×5 = 20 marks]', 'bold', 0), ('A. Genetic counselling', 'body', 20), ('B. Histology of liver', 'body', 20), ('C. Development of kidney with congenital anomalies', 'body', 20), ('D. Key techniques of effective communication', 'body', 20), ] render_page(p9, f'{OUT}/page_09_Uterus_Paper.png', 9, 10) # PAGE 10: Tongue paper p10 = [ ('ANATOMY - PAPER (Tongue Series)', 'heading', 0), ('1st MBBS Batch 2025-2026 | Preliminary Examination', 'subheading', 0), ('---', '', 0), ('SECTION B', 'subheading', 0), ('Q.2 Long Essay Question [1×10 = 10 marks]', 'bold', 0), ('A. Describe the Tongue under the following heads:', 'body', 0), (' 1. Parts (1)', 'body', 30), (' 2. Muscles (4)', 'body', 30), (' 3. Nerve supply (2)', 'body', 30), (' 4. Lymphatic drainage (1)', 'body', 30), (' 5. Applied anatomy (2)', 'body', 30), ('', '', 0), ('Q.3 Give the Reason (5 out of 6) [5×3 = 15 marks]', 'bold', 0), ('A. Anatomical basis of spina bifida. Enumerate various types of Spina bifida.', 'body', 20), ('B. Neglected infection in dangerous area of face led to cavernous sinus', 'body', 20), (' thrombosis. Anatomical basis of complications from related structures.', 'body', 20), ('C. Symptoms of Medial Medullary Syndrome.', 'body', 20), ('D. Newborn with cleft palate and nasal regurgitation of milk during breast', 'body', 20), (' feeding. Explain the congenital defect.', 'body', 20), ('E. Tuning fork deformity of wrist - anatomical basis.', 'body', 20), ('F. IM injection in deltoid in middle of muscle - what complication if given', 'body', 20), (' at another site?', 'body', 20), ('', '', 0), ('Q.4 Write short notes on (3 out of 4) [3×5 = 15 marks]', 'bold', 0), ('A. Rotator cuff of shoulder with applied anatomy', 'body', 20), ('B. Otic ganglion', 'body', 20), ('C. Course, relations, branches and applied anatomy of facial nerve', 'body', 20), ('D. Histology of lymph node', 'body', 20), ('', '', 0), ('SECTION C', 'subheading', 0), ("Q.5 Applied Aspect [4×5 = 20 marks]", 'bold', 0), ("A. Erb's paralysis", 'body', 20), ("B. Draw & label diagram of Broca's and Wernicke's area; describe its clinical anatomy", 'body', 20), ('C. Applied anatomy of scalp', 'body', 20), ('D. Ectopic pregnancy - tubal pregnancy with complications', 'body', 20), ('Q.6 Write short notes on [4×5 = 20 marks]', 'bold', 0), ('A. Parts of developing long bone; note on epiphysis', 'body', 20), ('B. Development and derivatives of pharyngeal pouches', 'body', 20), ('C. Histology of mixed salivary gland', 'body', 20), ('D. Pre-requisites of body donation', 'body', 20), ] render_page(p10, f'{OUT}/page_10_Tongue_Paper.png', 10, 10) print('Pages 9-10 done') PYEOF
ls -lh /tmp/workspace/handwritten-papers/
page 01 GMERS P1 SecB Q2Q3
Image · PNG
page 02 GMERS P1 SecC Q4Q5Q6
Image · PNG
page 03 GMERS P2 SecA B
Image · PNG
page 04 GMERS P2 SecC
Image · PNG
page 05 NAMO P1 SecB
Image · PNG
page 06 NAMO P1 SecC
Image · PNG
page 07 NAMO P2 SecB
Image · PNG
page 08 NAMO P2 SecC
Image · PNG
page 09 Uterus Paper
Image · PNG
page 10 Tongue Paper
Image · PNG
Combine all 10 pages into a single PDF document
python3 << 'PYEOF' from PIL import Image import os, glob OUT = '/tmp/workspace/handwritten-papers' pages = sorted(glob.glob(f'{OUT}/page_*.png')) print('Found pages:', [os.path.basename(p) for p in pages]) images = [] for p in pages: img = Image.open(p).convert('RGB') images.append(img) pdf_path = f'{OUT}/Anatomy_Compiled_Question_Papers.pdf' images[0].save( pdf_path, save_all=True, append_images=images[1:], resolution=150 ) size = os.path.getsize(pdf_path) print(f'PDF saved: {pdf_path} ({size/1024/1024:.2f} MB)') PYEOF
Anatomy Compiled Question Papers
PDF Document · PDF