Make this pdf organised and covernt it into pdf
cd /tmp/workspace/attachments/816ed51a-fcc1-45b1-9710-eb039cf94843/ && python3 -c " import pdfplumber with pdfplumber.open('anatomy imp topic.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'\n--- PAGE {i+1} ---') text = page.extract_text() if text: print(text) else: print('[No text extracted]') "
python3 -c " from pypdf import PdfReader import os path = '/tmp/workspace/attachments/816ed51a-fcc1-45b1-9710-eb039cf94843/anatomy imp topic.pdf' reader = PdfReader(path) print(f'Pages: {len(reader.pages)}') print(f'File size: {os.path.getsize(path)} bytes') # Check for images for i, page in enumerate(reader.pages): imgs = page.images print(f'Page {i+1}: {len(imgs)} images') for img in imgs: print(f' - {img.name}, size approx: {len(img.data)} bytes') "
python3 -c " from pypdf import PdfReader import os path = '/tmp/workspace/attachments/816ed51a-fcc1-45b1-9710-eb039cf94843/anatomy imp topic.pdf' reader = PdfReader(path) os.makedirs('/tmp/workspace/anatomy_pages', exist_ok=True) for i, page in enumerate(reader.pages): for img in page.images: out_path = f'/tmp/workspace/anatomy_pages/page_{i+1}.jpg' with open(out_path, 'wb') as f: f.write(img.data) print(f'Saved page {i+1} -> {out_path}') "
python3 -c " import subprocess result = subprocess.run(['pip', 'show', 'pytesseract'], capture_output=True, text=True) print(result.stdout) result2 = subprocess.run(['which', 'tesseract'], capture_output=True, text=True) print('tesseract:', result2.stdout) # Try PIL to read image info from PIL import Image img = Image.open('/tmp/workspace/anatomy_pages/page_1.jpg') print(f'Image size: {img.size}, mode: {img.mode}') "
mkdir -p /tmp/workspace/anatomy-pdf && python3 << 'EOF' from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, KeepTogether from reportlab.lib.enums import TA_LEFT, TA_CENTER # Color palette DARK_BLUE = colors.HexColor('#1a3a5c') MED_BLUE = colors.HexColor('#2e6da4') LIGHT_BLUE = colors.HexColor('#ddeeff') ACCENT_GOLD = colors.HexColor('#e8a020') MUST_RED = colors.HexColor('#c0392b') LIGHT_GREY = colors.HexColor('#f5f5f5') WHITE = colors.white doc = SimpleDocTemplate( '/tmp/workspace/anatomy-pdf/Anatomy_Important_Topics.pdf', pagesize=A4, rightMargin=1.8*cm, leftMargin=1.8*cm, topMargin=2*cm, bottomMargin=2*cm ) styles = getSampleStyleSheet() # Custom styles title_style = ParagraphStyle('Title', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=22, textColor=WHITE, alignment=TA_CENTER, spaceAfter=4) subtitle_style = ParagraphStyle('Subtitle', parent=styles['Normal'], fontName='Helvetica', fontSize=11, textColor=WHITE, alignment=TA_CENTER, spaceAfter=2) section_style = ParagraphStyle('Section', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=14, textColor=WHITE, alignment=TA_LEFT, spaceAfter=2, spaceBefore=2, leftIndent=6) subsection_style = ParagraphStyle('Subsection', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=10, textColor=MED_BLUE, alignment=TA_LEFT, spaceAfter=2, spaceBefore=4) must_style = ParagraphStyle('Must', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=9, textColor=MUST_RED, spaceAfter=1, spaceBefore=1) item_style = ParagraphStyle('Item', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=9.5, textColor=DARK_BLUE, spaceAfter=1, spaceBefore=1, leftIndent=8) year_style = ParagraphStyle('Year', parent=styles['Normal'], fontName='Helvetica', fontSize=8.5, textColor=colors.HexColor('#555555'), spaceAfter=2, leftIndent=22) other_style = ParagraphStyle('Other', parent=styles['Normal'], fontName='Helvetica', fontSize=8.5, textColor=colors.HexColor('#333333'), spaceAfter=1, leftIndent=8) embr_style = ParagraphStyle('Embr', parent=styles['Normal'], fontName='Helvetica', fontSize=8.5, textColor=colors.HexColor('#1a6e1a'), spaceAfter=1, leftIndent=8) clin_style = ParagraphStyle('Clin', parent=styles['Normal'], fontName='Helvetica', fontSize=8.5, textColor=colors.HexColor('#7b2d8b'), spaceAfter=1, leftIndent=8) def section_header(title, date_str): """Returns a colored banner for each section.""" data = [[Paragraph(title, section_style)]] t = Table(data, colWidths=[doc.width]) t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE), ('ROWBACKGROUNDS', (0,0), (-1,-1), [DARK_BLUE]), ('BOX', (0,0), (-1,-1), 0, DARK_BLUE), ('TOPPADDING', (0,0), (-1,-1), 6), ('BOTTOMPADDING', (0,0), (-1,-1), 6), ('LEFTPADDING', (0,0), (-1,-1), 10), ])) return t def cover_page(story): # Cover banner cover_data = [[ Paragraph('ANATOMY', title_style), ], [Paragraph('Important Topics — RUHS Last 10 Years', subtitle_style)], [Paragraph('Must Know (5★) & Other Asked Questions', subtitle_style)], ] cover_t = Table([[Paragraph('ANATOMY', title_style)], [Paragraph('Important Topics — RUHS Last 10 Years', subtitle_style)], [Paragraph('Must Know (5★) & Other Asked Questions', subtitle_style)]], colWidths=[doc.width]) cover_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE), ('TOPPADDING', (0,0), (-1,-1), 12), ('BOTTOMPADDING', (0,0), (-1,-1), 12), ('LEFTPADDING', (0,0), (-1,-1), 10), ])) story.append(cover_t) story.append(Spacer(1, 10)) toc_data = [ [Paragraph('<b>Section</b>', item_style), Paragraph('<b>Date</b>', item_style)], [Paragraph('1. Upper Limb', other_style), Paragraph('7/9/23', other_style)], [Paragraph('2. Lower Limb', other_style), Paragraph('9/9/23', other_style)], [Paragraph('3. Head & Neck', other_style), Paragraph('19/9/23', other_style)], [Paragraph('4. Thorax', other_style), Paragraph('8/9/23', other_style)], [Paragraph('5. Abdomen', other_style), Paragraph('8/9/23', other_style)], [Paragraph('6. Neuroanatomy', other_style), Paragraph('11/9/23', other_style)], ] toc_t = Table(toc_data, colWidths=[doc.width*0.75, doc.width*0.25]) toc_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), MED_BLUE), ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_GREY, WHITE]), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,-1), 9), ('BOX', (0,0), (-1,-1), 0.5, MED_BLUE), ('INNERGRID', (0,0), (-1,-1), 0.25, colors.HexColor('#cccccc')), ('TOPPADDING', (0,0), (-1,-1), 4), ('BOTTOMPADDING', (0,0), (-1,-1), 4), ('LEFTPADDING', (0,0), (-1,-1), 8), ('TEXTCOLOR', (0,0), (-1,0), WHITE), ])) story.append(Spacer(1, 6)) story.append(Paragraph('Contents', subsection_style)) story.append(toc_t) story.append(Spacer(1, 14)) # -------------------------------------------------------- # DATA # -------------------------------------------------------- sections = [ { 'title': '1. UPPER LIMB', 'date': '7/9/23', 'must_know': [ ('Lymphatics drainage of Breast', '2021, 20, 19, 17, 16, 13, 12'), ('Shoulder Joint', '2020, 18 Jul, 18 Oct, 16, 15, 14, 12'), ('Rotator Cuff', '2021, 19, 17, 16, 13'), ("Erb's Paralysis", '2021, 20, 18, 16, 13, 12'), ('Brachial Plexus and branches', '2020, 19, 18 (Remand), 17, 16'), ('Cubital Fossa', '2020, 16, 15, 14, 12'), ('Pronation and Supination', '2018, 16, 15, 12'), ('Deltoid Muscle', '2021, 16 Jul, 16 Nov, 12'), ('Wrist Drop', '2021, 20, 18, 14'), ('Nerves of Upper Limb', 'Median Nu. – 2018, 15 | Radial Nu. – 2019 | Ulnar Nu. – 2021, 16'), ], 'other': [ ('Median Cubital Vein', ''), ('Flexor Retinaculum in Hand', ''), ('Sterno-Clavicular Joint', ''), ('Lumbricals', ''), ('Superficial Palmar Arch', ''), ('Axilla', ''), ('Biceps Brachii Muscle', ''), ('Anatomical Snuffbox', ''), ('Brachial Artery', ''), ('Axillary Artery', ''), ('Anastomoses around Scapula', ''), ('1st Carpo-metacarpal Joint', ''), ], 'clinical': [ ("Dupuytren's Contracture", '2017'), ("Golfer's Elbow", '2017'), ('Saturday Night Palsy', '2016'), ('Horner Syndrome', '2015'), ("Klumpke's Paralysis", ''), ], 'embryology': [] }, { 'title': '2. LOWER LIMB', 'date': '9/9/23', 'must_know': [ ('Arches of Foot', '2021, 18 Oct, 18 Jul, 17 Aug, 16 Jul, 2012 Jul'), ('Great Saphenous Vein', '2020, 19, 18 Jul, 16 Jul, 16 Jan, 15, 2013'), ('Femoral Triangle, Canal & Sheath', '2020, 18 Oct, 16 Nov, 16 Jan, 15, 13 Jul'), ('Knee Joint Locking & Unlocking', '2018 Oct, 17 Nov, 17 Aug, 16 Nov, 16 Jan'), ('Hip Joint', '2021, 20, 18 Jul, 17 Aug'), ('Dorsalis Pedis Artery', '2021, 18 Oct, 17 Nov, 16 Jul, 15'), ('Nerves of Lower Limb', 'Obturator – 2018 Oct, 17 Nov, 16 Nov, 16 Jul | Deep Peroneal – 2017 Aug, 16 Jul | Common Peroneal – 2020 | Femoral Nu. – 2018 Jul'), ('Adductor Canal', '2021, 18 Oct, 13'), ('Foot Drop', '2021, 16 Nov, 16 Jan, 12 Jul'), ('Popliteal Fossa', '2019, 18 Oct, 16 Nov, 15 Aug'), ], 'other': [ ('Gluteus Maximus', '2021, 2016 Jan'), ('Plantar Aponeurosis', '2021, 2014'), ('Extensor Retinaculum of Foot', '2021, 2016 Jul'), ('Inversion of Foot', '2019 Jul, 2013'), ('Hamstring Muscles', '2018 Jul, 2016 Jul'), ('Gastrocnemius Muscle', '2017 Aug'), ('Lateral Plantar Nerve', '2015'), ('Guy Ropes', '2015'), ('Varicose Veins', '2012'), ('Sartorius Muscle', '2021'), ], 'clinical': [], 'embryology': [] }, { 'title': '3. HEAD & NECK', 'date': '19/9/23', 'must_know': [ ('Internal Capsule', '2021, 20, 19, 17 Aug, 16 Nov, 16 Jul, 2012'), ('Thyroid Gland (Development, Histo & Features)', '2020, 19, 18 Oct, 18 Jul, 17, 16 Nov, 16 Jul, 2015'), ('Parotid Gland (Development, Histo & Features)', '2021, 20, 18 Jul, 17 Aug, 16 Jul, 12 Jul'), ('Tongue (Development & Nerve Supply)', '2021, 20, 19, 17 Nov, 17 Aug, 16 Nov, 2016 Jul, 15, 12'), ('Muscles of Mastication', '2019, 18 Jul, 16 Jul'), ('Larynx (Muscles & Cartilages)', '2021, 15, 14, 17 Aug'), ('Lateral Wall of Nose', '2016 Nov, 16 Jul, 12'), ('Carotid Triangle & Sheath', '2018 Nov, 16 Jul, 16 Nov'), ('Lacrimal Apparatus', '2021, 18 Nov, 17 Aug'), ('Dural Venous Sinuses (Cavernous Sinus)', '2019, 17 Aug, 16 Jul'), ('Scalp', '2019 Nov, 15, 13'), ], 'other': [ ('Tympanic Membrane', '2021, 20'), ('External Carotid Artery', '2021, 16 Nov'), ('Nasal Septum', '2021'), ('Styloid Apparatus', '2021'), ('Tempero-Mandibular Joint', '2017 Nov'), ('Muscles of Soft Palate', '2016 Nov'), ('Sensory Supply of Face', '2016 Jul'), ('Mandibular Nerve', '2016 Jul'), ('Eustachian Tube', '2016 Jul'), ('Submandibular Gland', '2016 Jul'), ('Extra Ocular Muscles', '2015'), ('Digastric Triangle', '2014'), ('Pharynx', '2012'), ], 'clinical': [ ('Cleft Palate', '2020, 2017, 2015'), ("Killian's Dehiscence", '2017 Nov'), ("Frey's Syndrome", '2016 Jul'), ('1st Arch Syndrome', '2017 Nav'), ], 'embryology': [ ('Derivatives of Pharyngeal Arches', '2018 Oct, 18 Jul, 16 Nov, 16 Jul, 2016 Remand'), ('Development of Parathyroid Gland', '2019'), ('Development of Face', '2018 Nov, 18 Jul'), ('Development of Thyroid', '2018 Jul'), ('Development of Middle Ear', '2012'), ] }, { 'title': '4. THORAX', 'date': '8/9/23', 'must_know': [ ('Bronchopulmonary Segments', '2021, 20, 19, 18 Jul, 17 Aug, 17 Nov, 16 Jul, 16 Nov, 16 Jan'), ('Thoracic Duct', '2021, 20, 19, 16 Jul, 16 Nov'), ('Right Atrium', '2021, 18 Jul, 17 Nov, 12 Jul'), ('Coronary Circulation', '2021, 20, 16 Nov, 16 Jan'), ('Thoraco-abdominal Diaphragm', '2021, 18 Jul, 16 Nov'), ('Azygous Vein', '2018 Oct, 15, 14, 12'), ('Mediastinum', '2018 Oct, 16 Nov, 17 Aug'), ('Coronary Sinus', '2016 Jul, 15, 14'), ], 'other': [ ('Typical Intercostal Space', '2021, 2013'), ('Internal Thoracic Artery', '2019 Jul'), ('Mediastinal Surface of Right Lung', '2018 Oct'), ('Reflections of Pleura', '2016 Nov'), ('Intercostal Muscles', '2016 Jul'), ], 'clinical': [], 'embryology': [ ('Interatrial Septum', '2017 Nov, 2013'), ("Fallot's Tetralogy", '2020 Oct, 2019 Jul'), ('Fetal Circulation', '2019 Jul'), ('Sinuses of Pericardium', '2019 Jul'), ] }, { 'title': '5. ABDOMEN', 'date': '8/9/23', 'must_know': [ ('Uterus (Supports & Development)', '2021, 20, 19, 18 Oct, 17 Nov, 16 Jan, 2014, 12 Jul, 17 Aug'), ('Portal Vein & Porto-Caval Anastomoses', '2021, 20, 19, 16 Jan, 13 Jul'), ('Stomach Complete (Blood Supply & Stomach Bed)', '2021, 19, 18 Oct, 18 Jul, 17 Aug, 17 Nov, 16'), ('Rectum & Anal Canal (Ischio-anal Fossa)', '2017 Nov, 16 Nov, 16 Jul, 13'), ('Coeliac Trunk', '2021, 18 Oct, 16 Nov'), ('Rectus Sheath', '2018 Oct, 16 Nov, 16 Jul, 12 Jul'), ('Appendix + Applied', '2021, 17 Nov, 16 Jul, 16 Jan, 13'), ('Urinary Bladder (Nerve Supply)', '2021, 19, 16 Jul'), ('Inguinal Canal & Hernia', '2018 Jul, 17 Aug, 16 Nov, 12'), ('Second Part of Duodenum', '2018 Oct, 18 Jul, 16 Jul'), ("Meckel's Diverticulum", '2016 Jul, 20, 14, 12'), ], 'other': [ ('Perineal Body', '2021, 2016 Jul'), ('Liver Relations', '2020'), ('Pancreas Blood Supply', '2015'), ('Kidney Relations', '2018 Jul, 2016 Nov'), ('Paramesonephric Duct', '17 Nov, 12'), ('Mesonephric Duct', '19 Jul, 16 Jul'), ('Spleen', '2020, 12 Jul'), ('Lobes of Prostate', '16 Nov, 16 Jul'), ('Internal Iliac Artery', '2018 Jul'), ('Levator Ani + Applied', '2017 Nov'), ('Ligament of Treitz', '2017 Aug'), ('Pouch of Douglas', '2016 Nov'), ('Epiploic Foramen', '2016 Nov'), ('Lesser Sac', '2016 Jul'), ('Deep Perineal Pouch', '2016 Jan'), ('Pudendal Canal', '2015'), ('Lymphatic Drainage of Testis', '2015'), ('Spermatic Cord', '2013'), ('Abdominal Aorta', '2012'), ('Root of Mesentery', '2016 Nov'), ], 'clinical': [], 'embryology': [ ('Development of Pancreas', '2018 Jul, 17 Aug, 16 Nov, 16 Jul, 2015, 13'), ('Development of Uterus', '2020, 18, 17, 16'), ('Rectum', '2017, 16 Jul'), ('Urinary Bladder', '16 Jan'), ('Gall Bladder', '2015'), ('Liver', '2012'), ('Kidney', ''), ] }, { 'title': '6. NEUROANATOMY', 'date': '11/9/23', 'must_know': [ ('Fourth Ventricle', '2021, 20, 19, 18 Nov, 18 Jul, 17 Aug, 2016 Nov, 15, 14'), ("Facial Nerve & Bell's Palsy", '2020, 18 Nov, 18 Jul, 17 Aug, 16 Nov, 2014'), ('Circle of Willis (Blood Supply of Brain)', '2021, 19, 18 Jul, 16 Nov, 12'), ('Transverse Sections in Brainstem & Spinal Cord', 'Medulla (Sensory decussation) – 2016 Remand, 2016 | Medulla (Pyramidal decussation) – 2012 | Mid Brain (Sup Colliculus) – 2020 | Mid Brain (Inf Colliculus) – 2015 | Pons (Facial Colliculus) – 2012 | Spinal Cord – 2018, 14'), ('Inferior Cerebellar Peduncle', '2019, 17 Nov, 16 Nov'), ('Otic Ganglion', '2018 Oct, 18 Jul, 17 Nov'), ], 'other': [ ('Ciliary Ganglion', '2021, 20'), ('Pyramidal Tracts', '2021, 16 Jul'), ('Visual Pathway', '2015, 12'), ('Lateral Geniculate Body', '2017 Nov, 16 Jul'), ('Lateral Medullary Syndrome', '2021, 17 Nov'), ('Spina Bifida', '2021, 17 Nov'), ('Lateral Spinothalamic Tracts', '2020'), ('Substantia Nigra', '2019'), ('Nuclei of Trigeminal Nerve', '2019'), ('Nuclei of Thalamus', '2018 Oct'), ('Motor Areas of Cerebellum', '2017 Nov'), ('Corpus Callosum', '2016 Nov'), ('Third Ventricle', '2016 Jul'), ('Nuclei of Cerebellum', '2016 Jul Remand'), ('Hippocampus & Rhinencephalon', '2014'), ], 'clinical': [], 'embryology': [] }, ] # -------------------------------------------------------- # BUILD STORY # -------------------------------------------------------- story = [] cover_page(story) for sec in sections: # Section header hdr_data = [[Paragraph(sec['title'], section_style), Paragraph(sec['date'], subtitle_style)]] hdr_t = Table(hdr_data, colWidths=[doc.width*0.75, doc.width*0.25]) hdr_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE), ('TOPPADDING', (0,0), (-1,-1), 7), ('BOTTOMPADDING', (0,0), (-1,-1), 7), ('LEFTPADDING', (0,0), (-1,-1), 10), ('RIGHTPADDING', (0,0), (-1,-1), 8), ('ALIGN', (1,0), (1,0), 'RIGHT'), ])) story.append(KeepTogether([hdr_t])) story.append(Spacer(1, 6)) # Must Know if sec['must_know']: story.append(Paragraph('★ MUST KNOW (5★ Priority)', must_style)) story.append(Spacer(1, 3)) mk_rows = [ [Paragraph('<b>#</b>', item_style), Paragraph('<b>Topic</b>', item_style), Paragraph('<b>Year(s)</b>', item_style)] ] for idx, (topic, years) in enumerate(sec['must_know'], 1): mk_rows.append([ Paragraph(str(idx), year_style), Paragraph(topic, item_style), Paragraph(years, year_style), ]) mk_t = Table(mk_rows, colWidths=[0.5*cm, doc.width*0.42, doc.width*0.52]) mk_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), MED_BLUE), ('TEXTCOLOR', (0,0), (-1,0), WHITE), ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_BLUE, WHITE]), ('FONTSIZE', (0,0), (-1,-1), 8.5), ('BOX', (0,0), (-1,-1), 0.5, MED_BLUE), ('INNERGRID', (0,0), (-1,-1), 0.2, colors.HexColor('#aaccee')), ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3), ('LEFTPADDING', (0,0), (-1,-1), 5), ('VALIGN', (0,0), (-1,-1), 'TOP'), ])) story.append(mk_t) story.append(Spacer(1, 6)) # Other asked questions if sec['other']: story.append(Paragraph('Other Asked Questions (Last 10 Years)', subsection_style)) other_rows = [[Paragraph('<b>Topic</b>', item_style), Paragraph('<b>Year</b>', item_style)]] for topic, year in sec['other']: other_rows.append([Paragraph(topic, other_style), Paragraph(year, year_style)]) other_t = Table(other_rows, colWidths=[doc.width*0.65, doc.width*0.35]) other_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#4a6fa5')), ('TEXTCOLOR', (0,0), (-1,0), WHITE), ('ROWBACKGROUNDS', (0,1), (-1,-1), [LIGHT_GREY, WHITE]), ('FONTSIZE', (0,0), (-1,-1), 8.5), ('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')), ('INNERGRID', (0,0), (-1,-1), 0.2, colors.HexColor('#cccccc')), ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3), ('LEFTPADDING', (0,0), (-1,-1), 5), ('VALIGN', (0,0), (-1,-1), 'TOP'), ])) story.append(other_t) story.append(Spacer(1, 6)) # Clinical Questions if sec['clinical']: story.append(Paragraph('Clinical Questions', ParagraphStyle('ClinHead', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=10, textColor=colors.HexColor('#7b2d8b'), spaceAfter=2))) clin_rows = [[Paragraph('<b>Topic</b>', item_style), Paragraph('<b>Year</b>', item_style)]] for topic, year in sec['clinical']: clin_rows.append([Paragraph(topic, clin_style), Paragraph(year, year_style)]) clin_t = Table(clin_rows, colWidths=[doc.width*0.65, doc.width*0.35]) clin_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#7b2d8b')), ('TEXTCOLOR', (0,0), (-1,0), WHITE), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f5e6ff'), WHITE]), ('FONTSIZE', (0,0), (-1,-1), 8.5), ('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')), ('INNERGRID', (0,0), (-1,-1), 0.2, colors.HexColor('#cccccc')), ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3), ('LEFTPADDING', (0,0), (-1,-1), 5), ('VALIGN', (0,0), (-1,-1), 'TOP'), ])) story.append(clin_t) story.append(Spacer(1, 6)) # Embryology Questions if sec['embryology']: story.append(Paragraph('Embryology Questions', ParagraphStyle('EmbrHead', parent=styles['Normal'], fontName='Helvetica-Bold', fontSize=10, textColor=colors.HexColor('#1a6e1a'), spaceAfter=2))) embr_rows = [[Paragraph('<b>Topic</b>', item_style), Paragraph('<b>Year</b>', item_style)]] for topic, year in sec['embryology']: embr_rows.append([Paragraph(topic, embr_style), Paragraph(year, year_style)]) embr_t = Table(embr_rows, colWidths=[doc.width*0.65, doc.width*0.35]) embr_t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a6e1a')), ('TEXTCOLOR', (0,0), (-1,0), WHITE), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e6ffe6'), WHITE]), ('FONTSIZE', (0,0), (-1,-1), 8.5), ('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')), ('INNERGRID', (0,0), (-1,-1), 0.2, colors.HexColor('#cccccc')), ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3), ('LEFTPADDING', (0,0), (-1,-1), 5), ('VALIGN', (0,0), (-1,-1), 'TOP'), ])) story.append(embr_t) story.append(Spacer(1, 10)) story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE)) story.append(Spacer(1, 10)) doc.build(story) print("PDF created successfully!") import os print(f"File size: {os.path.getsize('/tmp/workspace/anatomy-pdf/Anatomy_Important_Topics.pdf')} bytes") EOF
Anatomy Important Topics
PDF Document · PDF
| # | Section | Date |
|---|---|---|
| 1 | Upper Limb | 7/9/23 |
| 2 | Lower Limb | 9/9/23 |
| 3 | Head & Neck | 19/9/23 |
| 4 | Thorax | 8/9/23 |
| 5 | Abdomen | 8/9/23 |
| 6 | Neuroanatomy | 11/9/23 |