Skip to content

Commit dcdfccc

Browse files
authored
Merge pull request #1855 from vikrantwiz02/prod/acad-react
Refactor PDF generation of transcript headers for improved formatting and clarity
2 parents f315836 + fb35b7b commit dcdfccc

File tree

1 file changed

+15
-14
lines changed
  • FusionIIIT/applications/examination/api

1 file changed

+15
-14
lines changed

FusionIIIT/applications/examination/api/views.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,16 +2326,16 @@ def generate_student_result_pdf(self, request):
23262326

23272327
subtitle_style = ParagraphStyle(
23282328
'Subtitle',
2329-
parent=styles['Normal'],
2329+
parent=styles['Heading2'],
23302330
fontSize=11,
23312331
spaceAfter=6,
23322332
alignment=1, # Center
23332333
fontName='Times-Bold'
23342334
)
23352335

23362336
# Institution Header
2337-
story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style))
2338-
story.append(Paragraph("Manufacturing, Jabalpur", title_style))
2337+
story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style))
2338+
story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style))
23392339
story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style))
23402340
story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style))
23412341
story.append(Spacer(1, 20))
@@ -3474,7 +3474,8 @@ def post(self, request):
34743474
'Title',
34753475
parent=styles['Heading1'],
34763476
fontSize=14,
3477-
spaceAfter=8,
3477+
spaceAfter=2,
3478+
leading=18,
34783479
alignment=1, # Center
34793480
fontName='Times-Bold'
34803481
)
@@ -3501,10 +3502,10 @@ def post(self, request):
35013502
logo = Image(logo_path, width=0.8*inch, height=0.8*inch)
35023503

35033504
# Create separate paragraphs for better text formatting
3504-
title_para = Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style)
3505-
subtitle1_para = Paragraph("Manufacturing, Jabalpur", title_style)
3505+
title_para = Paragraph("PDPM Indian Institute of Information Technology,", title_style)
3506+
subtitle1_para = Paragraph("Design & Manufacturing, Jabalpur", title_style)
35063507
subtitle2_para = Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style)
3507-
subtitle3_para = Paragraph("Semester Grade Report / Marksheet", subtitle_style)
3508+
subtitle3_para = Paragraph("<b><u>Semester Grade Report / Marksheet</u></b>", subtitle_style)
35083509

35093510
# Create header table with logo and text
35103511
header_table_data = [
@@ -3523,16 +3524,16 @@ def post(self, request):
35233524
story.append(header_table)
35243525
else:
35253526
# No logo, just text
3526-
story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style))
3527-
story.append(Paragraph("Manufacturing, Jabalpur", title_style))
3527+
story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style))
3528+
story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style))
35283529
story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style))
3529-
story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style))
3530+
story.append(Paragraph("<b><u>Semester Grade Report / Marksheet</u></b>", subtitle_style))
35303531
except Exception as e:
35313532
# If logo fails, continue with text only
3532-
story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style))
3533-
story.append(Paragraph("Manufacturing, Jabalpur", title_style))
3533+
story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style))
3534+
story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style))
35343535
story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style))
3535-
story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style))
3536+
story.append(Paragraph("<b><u>Semester Grade Report / Marksheet</u></b>", subtitle_style))
35363537

35373538
story.append(Spacer(1, 12))
35383539

@@ -3551,7 +3552,7 @@ def post(self, request):
35513552
[Paragraph('Semester:', cell_style), Paragraph(formatted_semester, cell_style), Paragraph('Academic Year:', cell_style), Paragraph(student_info.get('academicYear', student_info.get('academic_year', 'N/A')), cell_style)]
35523553
]
35533554

3554-
student_table = Table(student_data, colWidths=[1.75*inch, 1.75*inch, 1.75*inch, 1.75*inch])
3555+
student_table = Table(student_data, colWidths=[1.14*inch, 3.56*inch, 1.3*inch, 1.0*inch])
35553556
student_table.setStyle(TableStyle([
35563557
('FONTNAME', (0, 0), (-1, -1), 'Times-Roman'),
35573558
('FONTSIZE', (0, 0), (-1, -1), 10),

0 commit comments

Comments
 (0)