from fpdf import FPDF
class PDF(FPDF):
def header(self):
self.set_font('Arial', 'B', 12)
self.set_text_color(50, 50, 255)
[Link](0, 10, 'Communication Skills', 0, 1, 'C')
def footer(self):
self.set_y(-15)
self.set_font('Arial', 'I', 8)
[Link](0, 10, 'Page %s' % self.page_no(), 0, 0, 'C')
def chapter_title(self, title):
self.set_font('Arial', 'B', 16)
self.set_fill_color(200, 220, 255)
[Link](0, 10, title, 0, 1, 'C', 1)
[Link](10)
def chapter_body(self, body):
self.set_font('Arial', '', 12)
self.multi_cell(0, 10, body)
[Link]()
def add_bullets(self, points):
self.set_font('Arial', 'B', 12)
for point in points:
[Link](0, 10, f"- {point}", 0, 1)
def add_table(self, data):
self.set_font('Arial', 'B', 12)
self.set_fill_color(200, 220, 255)
for row in data:
for item in row:
[Link](48, 10, str(item), 1, 0, 'C', 1)
[Link]()
pdf = PDF()
# Cover page
pdf.add_page()
pdf.set_font("Arial", size=24)
[Link](200, 10, "Communication Skills", ln=True, align='C')
# Add cover page details
pdf.set_font("Arial", size=12)
details = [
"Name: [Your Name]",
"Class: IX",
"Section: [Your Section]",
"Roll Number: [Your Roll Number]",
"Subject: Information Technology (402)",
"Topic: Communication Skills",
"Session: 2024-25",
"School: Bina Mohit Memorial School"
]
for detail in details:
[Link](200, 10, detail, ln=True, align='L')
# Add index page
pdf.add_page()
pdf.chapter_title("Index")
index = [
"1. Introduction to Communication Skills",
"2. Types of Communication",
"3. Importance of Communication Skills",
"4. Verbal Communication",
"5. Non-verbal Communication",
"6. Listening Skills",
"7. Barriers to Effective Communication",
"8. Communication in the Digital Age",
"9. Summary",
"10. References"
]
pdf.add_bullets(index)
# Function to add content pages
def add_content_page(title, body, bullets=None, table=None):
pdf.add_page()
pdf.chapter_title(title)
pdf.chapter_body(body)
if bullets:
pdf.add_bullets(bullets)
if table:
pdf.add_table(table)
# Enhanced content for each section
content_dict = {
"Introduction to Communication Skills": [
"Communication skills are vital for personal and professional success. "
"They encompass both verbal and non-verbal elements and are essential for effective interaction."
],
"Types of Communication": [
"There are various types of communication:",
["Verbal Communication", "Non-verbal Communication", "Written Communication", "Visual Communication"]
],
"Importance of Communication Skills": [
"Effective communication skills are important for building relationships, resolving conflicts, "
"and ensuring mutual understanding. Key benefits include:",
["Better relationships", "Clearer understanding", "Increased productivity"]
],
"Verbal Communication": [
"Verbal communication involves the use of words to convey a message. It can be spoken or written "
"and is a primary method of communication. Examples include:",
["Conversations", "Presentations", "Written letters"]
],
"Non-verbal Communication": [
"Non-verbal communication includes body language, facial expressions, gestures, and tone of voice. "
"It often conveys more information than words. Common non-verbal cues include:",
["Facial expressions", "Gestures", "Posture"]
],
"Listening Skills": [
"Active listening is crucial for effective communication. It involves paying full attention to the speaker, "
"understanding their message, and responding thoughtfully. Steps to active listening:",
["Pay attention", "Show that you're listening", "Provide feedback", "Defer judgment", "Respond appropriately"]
],
"Barriers to Effective Communication": [
"Common barriers include language differences, cultural misunderstandings, and emotional barriers. "
"Overcoming these is key to effective communication. Barriers to be aware of:",
["Language differences", "Cultural differences", "Emotional barriers"]
],
"Communication in the Digital Age": [
"Digital communication includes emails, social media, and other online platforms. It has transformed how we interact "
"and requires new skills. Examples of digital communication methods:",
["Emails", "Social media", "Instant messaging"]
],
"Summary": [
"Good communication skills are essential in all areas of life. Practicing and improving these skills can lead to better relationships "
"and professional success."
],
"References": [
"1. Your textbook: Chapter 1 on Communication Skills",
"2. Online resources and articles on communication"
]
}
# Add content pages
for title, content in content_dict.items():
if isinstance(content[1], list):
add_content_page(title, content[0], content[1])
else:
add_content_page(title, content[0])
# Placeholder for pictures
pdf.add_page()
pdf.chapter_title("Pictures")
pdf.chapter_body("Insert pictures relevant to communication skills here.")
# Example table
pdf.add_page()
pdf.chapter_title("Example Table")
table_data = [["Type", "Description"],
["Verbal", "Using words to convey a message"],
["Non-verbal", "Using body language, gestures, and facial expressions"],
["Written", "Communication through written words"],
["Visual", "Using visual aids to convey messages"]]
pdf.add_table(table_data)
# Save the enhanced pdf with name .pdf
file_path = "Enhanced_Communication_Skills_Practical_File.pdf"
[Link](file_path)