Untitled

 avatar
unknown
plain_text
a month ago
1.1 kB
2
Indexable
# Fix encoding issue by replacing special characters with standard ones

muscle_contraction_fixed = muscle_contraction.replace("’", "'").replace("–", "-")

bones_skull_fixed = bones_skull.replace("’", "'").replace("–", "-")

# Create PDF again
pdf = FPDF()
pdf.set_auto_page_break(auto=True, margin=15)
pdf.add_page()
pdf.set_font("Arial", size=12)

# Title
pdf.set_font("Arial", style='B', size=14)
pdf.cell(200, 10, txt="Short Notes", ln=True, align='C')

# Content
pdf.set_font("Arial", size=12)
pdf.ln(10)

# Physiology of Muscle Contraction
pdf.set_font("Arial", style='B', size=12)
pdf.cell(0, 10, "1. Physiology of Muscle Contraction", ln=True)
pdf.set_font("Arial", size=12)
pdf.multi_cell(0, 10, muscle_contraction_fixed)

# Bones of the Skull
pdf.ln(5)
pdf.set_font("Arial", style='B', size=12)
pdf.cell(0, 10, "2. Bones of the Skull", ln=True)
pdf.set_font("Arial", size=12)
pdf.multi_cell(0, 10, bones_skull_fixed)

# Save PDF
file_path = "/mnt/data/Physiology_and_Skull_Notes.pdf"
pdf.output(file_path)

file_path
Editor is loading...
Leave a Comment