File size: 527 Bytes
f3f0a69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from reportlab.pdfgen import canvas
import tempfile

def generate_summary_pdf(candidates):
    """Generate a PDF report for shortlisted candidates."""
    temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
    c = canvas.Canvas(temp_file.name)
    
    c.drawString(100, 800, "Shortlisted Candidates")
    y = 780
    for candidate in candidates:
        y -= 20
        c.drawString(100, y, f"{candidate.name} - Score: {candidate.score}")
    
    c.save()
    return temp_file.name  # Return path to the PDF