File size: 1,930 Bytes
95a0611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e65b18
 
 
 
 
 
 
 
 
 
 
 
2f90430
9e65b18
 
 
95a0611
7f9de31
95a0611
 
 
7f9de31
95a0611
7f9de31
95a0611
7f9de31
 
 
 
 
 
 
 
 
 
95a0611
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class ResumeBuilder(FPDF):
    def header(self):
        self.set_font("Arial", "B", 16)
        self.set_text_color(50, 50, 50)
        self.cell(0, 10, "ATS-Friendly Resume", align="C", ln=True)
        self.ln(10)

    def add_section(self, title, content):
        self.set_font("Arial", "B", 12)
        self.set_text_color(50, 50, 50)
        self.cell(0, 10, title, ln=True)
        self.set_font("Arial", "", 12)
        self.set_text_color(80, 80, 80)
        self.multi_cell(0, 10, content)
        self.ln(5)

    def add_image(self, image):
        # Open the image
        image = Image.open(image)
        
        # Convert image to RGB (remove alpha channel if it exists)
        if image.mode == "RGBA":
            image = image.convert("RGB")
        
        # Save the image in a temporary file in a format that FPDF accepts (JPEG)
        with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_file:
            image.save(temp_file, "JPEG")  # Ensure the image is saved as JPEG
            temp_file_path = temp_file.name

        # Add the image to the PDF
        self.image(temp_file_path, x=10, y=self.get_y(), w=30, h=30)
        self.set_y(self.get_y() + 35)

    def add_social_icons(self, linkedin=None, email=None, phone=None):
        self.set_font("Arial", "B", 12)
        self.cell(0, 10, "Contact Information:", ln=True)
        self.set_font("Arial", "", 12)
        
        if linkedin:
            self.cell(0, 10, f"LinkedIn: [icon]({linkedin})", ln=True)
        if email:
            self.cell(0, 10, f"Email: [icon]({email})", ln=True)
        if phone:
            self.cell(0, 10, f"Phone: {phone}", ln=True)
        self.ln(5)

    def add_skills(self, skills, title="Skills"):
        self.set_font("Arial", "B", 12)
        self.cell(0, 10, title, ln=True)
        self.set_font("Arial", "", 12)
        self.multi_cell(0, 10, "\n".join(skills))
        self.ln(5)