Open In App

Resume Generator App Using Python

In this article, we will explain how to create the Resume Generator App using Python. To generate the resume, we will utilize an API and demonstrate how we can easily create a personalized resume by providing essential details. The information includes skills, education, experience, grades, and other crucial details that we typically include in our resumes.

What is the Resume Generator App?

The Resume Generator App is a user-friendly tool that simplifies the resume creation process. It organizes key information into sections such as Education, Skills, Experience, Projects, Achievements, and Other Activities, allowing users to input details seamlessly. This automated approach ensures a well-structured and visually appealing resume, covering academic achievements, professional skills, work experiences, projects, achievements, and extracurricular activities.



Resume Generator App Using Python

Below, are the implementations of the Resume Generator App Using Python step-by-step.

Create Virtual Environment

First, create the virtual environment using the below commands



python -m venv env 
.\env\Scripts\activate.ps1

File Structure

Implement the Logic

In this example, below code facilitates the creation of a resume by interacting with the user, gathering input, generating Markdown content, and converting it into a PDF file using an external API. The script defines a function convert_markdown_to_pdf that takes Markdown content, a file name (defaulted to “Resume.pdf”), and an engine (defaulted to “weasyprint”) as parameters. This function includes CSS styles, specifies an API endpoint for converting Markdown to PDF, and sends a POST request with the Markdown content and CSS to the API. The response is then processed: if successful, the generated PDF is saved; otherwise, an error message is displayed.




import requests
 
def convert_markdown_to_pdf(markdown_content, Resume_file="Resume.pdf", engine="weasyprint"):
    # Define CSS styles for the PDF
    cssfile = """
                body{
                    padding: 0px;
                    margin:0px;
                }
                h1 {
                color: MidnightBlue;
                margin:0px;
                padding:0px;
                     
                }
                h3{
                    color: MidnightBlue;
                    padding-bottom:0px;
                    margin-bottom:0px;
                }
                li{
                    margin-top:5px;
                }
                 
                """
    # API endpoint for converting Markdown to PDF
    url = "https://md-to-pdf.fly.dev"
 
    # Data to be sent in the POST request
    data = {
        'markdown': markdown_content,
        'css': cssfile,
        'engine': engine
    }
 
    # Send a POST request to the API
    response = requests.post(url, data=data)
 
    # Check if the response is successful (status code 200)
    if response.status_code == 200:
        # Save the generated PDF to a file
        with open(Resume_file, 'wb') as f:
            f.write(response.content)
        print(f"PDF saved to {Resume_file}")
    else:
        print(f"Error {response.status_code}: {response.text}")
 
class Resume:
    def __init__(self, name, email, mobile, education, skills, experience, projects,
                 achievements, activities):
        # Initialize the Resume object with user information
        self.name = name
        self.email = email
        self.mobile = mobile
        self.education = education
        self.skills = skills
        self.experience = experience
        self.projects = projects
        self.achievements = achievements
        self.activities = activities
 
    def generate_markdown(self):
        # Generate Markdown content for the resume
        markdown_text = f"<h1 style=\"text-align:center;\">{self.name
                    }</h1>\n<p style=\"text-align:center;\">Email: {self.email
                    } | Mobile: {self.mobile} </p>\n\n"
        markdown_text += "### Education\n\n---\n\n"
        # Add education details to the Markdown content
        for edu in self.education:
            markdown_text += f"- {edu['level']}: {edu['institution']} | {edu['field']
                                    } | Score: {edu['score']} | {edu['duration']}." + "\n\n"
 
        markdown_text += "### Skills\n\n---\n\n"
        # Add skills to the Markdown content
        markdown_text += f"{self.skills} \n\n"
 
        markdown_text += "### Experience\n\n---\n\n"
        # Add work experience details to the Markdown content
        for exp in self.experience:
            markdown_text += f"- **{exp['job_role']}({exp['company_name']})**: {exp['description']}\n"
 
        markdown_text += "\n### Projects\n\n---\n\n"
        # Add project details to the Markdown content
        for proj in self.projects:
            markdown_text += f"- **{proj['name']}**: {proj['description']}\n"
 
        markdown_text += "\n### Achievements\n\n---\n\n"
        # Add achievement details to the Markdown content
        for ach in self.achievements:
            markdown_text += f"- {ach}\n"
 
        markdown_text += "\n### Other Activities\n\n---\n\n"
        # Add other activities to the Markdown content
        markdown_text += self.activities + '\n'
 
        return markdown_text
  
def get_user_input():
    # Gather user input for creating the resume
    name = input("Enter your name: ")
    email = input("Enter your email: ")
    mobile = input("Enter your mobile number: ")
 
    print("\nEducation:")
    education = []
    while True:
        # Prompt user to add education details
        edu_input = input(
            "Do you want to add education details? (yes/no): ").lower()
        if edu_input != 'yes':
            break
        level = input(
        "Enter education level (e.g., Graduation(UG/PG), High School): ")
        institution = input(f"Enter the name of the {level} institution: ")
        field = input(f"Enter the field of study at {institution}: ")
        duration = input(f"Enter passing year of {level} at {institution}: ")
        score = input(
        f"Enter your score (e.g., GPA/Percentage) of {level} at {institution}: ")
        education.append({"level": level,"institution": institution,
                          "field": field,"duration": duration,"score": score,})
 
    skills = input("\nEnter your skills (comma-separated): ")
 
    print("\nExperience:")
    experience = []
    while True:
        # Prompt user to add work experience details
        job_role = input("Enter your job role (or type 'done' to finish): ")
        if job_role.lower() == 'done':
            break
        exp_company_name = input("Enter the company name: ")
        exp_description = input(f"Enter the description for '{job_role}': ")
        experience.append(
            {"job_role": job_role, "company_name": exp_company_name,
             "description": exp_description})
 
    print("\nProjects:")
    projects = []
    while True:
        # Prompt user to add project details
        proj_heading = input(
            "Enter the project Title (or type 'done' to finish): ")
        if proj_heading.lower() == 'done':
            break
        proj_description = input(
            f"Enter the description for '{proj_heading}': ")
        projects.append(
            {"name": proj_heading, "description": proj_description})
 
    print("\nAchievements:")
    achievements = []
    while True:
        # Prompt user to add achievement details
        ach_input = input(
            "Enter an achievement detail (or type 'done' to finish): ")
        if ach_input.lower() == 'done':
            break
        achievements.append(ach_input)
 
    print("\nOther Activities like hobbies:")
    # Prompt user to add other activities or hobbies
    activities = input("Enter your other activities: ")
    return Resume(name, email, mobile, education, skills,
                  experience, projects, achievements, activities)
 
if __name__ == "__main__":
    # Main execution block
    user_resume = get_user_input()
    markdown_text = user_resume.generate_markdown()
    convert_markdown_to_pdf(markdown_text)

Run the Server

run the server using below commands

python script_name.py

Output:

Conclusion

In Conclusion, the provided Python script provides an efficient and automated method for crafting polished resumes. Through the utilization of user input and Markdown capabilities, the script generates a visually pleasing and well-organized resume encompassing crucial sections like education, skills, experience, projects, achievements, and other activities. The inclusion of CSS styling further elevates the aesthetics of the final PDF, ensuring a professional and cohesive presentation.


Article Tags :