16/03/2026
from docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.section import WD_SECTION
from docx.oxml import OxmlElement
from docx.oxml.ns import qn
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_CELL_VERTICAL_ALIGNMENT
from docx.shared import Cm
import os
photo_path = "/mnt/data/WhatsApp Image 2026-01-26 at 7.33.23 PM.jpeg"
out_path = "/mnt/data/Rabbi_Molla_CV.pdf"
doc = Document()
# Page setup
section = doc.sections[0]
section.top_margin = Cm(1.5)
section.bottom_margin = Cm(1.5)
section.left_margin = Cm(1.8)
section.right_margin = Cm(1.8)
# Base font
styles = doc.styles
styles["Normal"].font.name = "Arial"
styles["Normal"].font.size = Pt(10.5)
# Helper
def set_cell_border(cell, **kwargs):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
tcBorders = tcPr.first_child_found_in("w:tcBorders")
if tcBorders is None:
tcBorders = OxmlElement('w:tcBorders')
tcPr.append(tcBorders)
for edge in ('left', 'top', 'right', 'bottom'):
edge_data = kwargs.get(edge)
if edge_data:
tag = 'w:{}'.format(edge)
element = tcBorders.find(qn(tag))
if element is None:
element = OxmlElement(tag)
tcBorders.append(element)
for key in ["val", "sz", "space", "color"]:
if key in edge_data:
element.set(qn('w:{}'.format(key)), str(edge_data[key]))
# Header block with image on right
table = doc.add_table(rows=1, cols=2)
table.alignment = WD_TABLE_ALIGNMENT.CENTER
table.autofit = False
table.columns[0].width = Cm(12.8)
table.columns[1].width = Cm(4.0)
left = table.cell(0, 0)
right = table.cell(0, 1)
left.vertical_alignment = WD_CELL_VERTICAL_ALIGNMENT.TOP
right.vertical_alignment = WD_CELL_VERTICAL_ALIGNMENT.TOP
for c in (left, right):
set_cell_border(c,
top={"val": "nil"},
bottom={"val": "nil"},
left={"val": "nil"},
right={"val": "nil"})
p = left.paragraphs[0]
r = p.add_run("CURRICULUM VITAE")
r.bold = True
r.font.size = Pt(17)
p.space_after = Pt(10)
for label, value in [
("Name", "Rabbi Molla"),
("Profession", "Student & Mobile Application Developer"),
("Mobile", "01646-786-778"),
("Email", "[email protected]"),
]:
para = left.add_paragraph()
para.paragraph_format.space_after = Pt(2)
run1 = para.add_run(f"{label}: ")
run1.bold = True
run2 = para.add_run(value)
rp = right.paragraphs[0]
rp.alignment = WD_ALIGN_PARAGRAPH.RIGHT
rr = rp.add_run()
rr.add_picture(photo_path, width=Inches(1.45))
doc.add_paragraph()
def add_heading(text):
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(6)
p.paragraph_format.space_after = Pt(3)
r = p.add_run(text)
r.bold = True
r.font.size = Pt(11.5)
def add_body(text):
p = doc.add_paragraph(text)
p.paragraph_format.space_after = Pt(4)
p.paragraph_format.line_spacing = 1.15
add_heading("Career Objective")
add_body("Motivated Mobile Application Developer with practical experience in Android app development. Skilled in Java, XML, PHP, and database management. Passionate about building useful mobile applications and continuously improving technical skills in software development, robotics, and IoT.")
add_heading("Educational Qualification")
for title, sub in [
("B.Sc in Computer Science & Engineering (Running)", "Currently studying."),
("Diploma in Engineering", "Completed: 2025 | CGPA: 3.67 out of 4.00"),
("Secondary School Certificate (SSC)", "Year: 2021 | GPA: 3.56 out of 5.00"),
]:
p = doc.add_paragraph()
p.paragraph_format.space_after = Pt(1)
r = p.add_run(title)
r.bold = True
p2 = doc.add_paragraph(sub)
p2.paragraph_format.left_indent = Cm(0.4)
p2.paragraph_format.space_after = Pt(3)
add_heading("Professional Experience")
add_body("Mobile Application Development Experience: Approximately 2 Years 4 Months. Working with Android application development including UI design, backend integration, database management, and API integration.")
add_heading("Skills")
for line in [
"Full Stack Mobile App Developer (Android)",
"Programming: Java, C++",
"UI: XML (Android UI)",
"Backend: PHP",
"Database: MySQL, SQLite",
"Integration: REST API Integration, Payment Gateway Integration",
"Robotics & IoT Development using C++",
"English Typing: Good speed and high accuracy",
]:
p = doc.add_paragraph(line)
p.paragraph_format.space_after = Pt(2)
add_heading("Profession")
add_body("Student & Mobile Application Developer")
docx_path = "/mnt/data/Rabbi_Molla_CV.docx"
doc.save(docx_path)
# Convert docx to pdf using libreoffice
import subprocess, textwrap, tempfile, pathlib, shutil
subprocess.run([
"python", "/home/oai/skills/docx/render_docx.py",
docx_path,
"--output_dir", "/mnt/data/rendered_cv",
"--emit_pdf"
], check=True)
generated_pdf = "/mnt/data/rendered_cv/Demo_CV.pdf"
if os.path.exists(generated_pdf):
shutil.copyfile(generated_pdf, out_path)
print(f"Created: {out_path}")