From 6f1c94ebdef698b59d1bdf5507d11cadda9930e3 Mon Sep 17 00:00:00 2001 From: vikrantwiz02 Date: Fri, 5 Dec 2025 15:26:07 +0530 Subject: [PATCH 1/2] Refactor PDF generation headers for improved formatting and clarity --- .../applications/examination/api/views.py | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/FusionIIIT/applications/examination/api/views.py b/FusionIIIT/applications/examination/api/views.py index de0741112..4a635cbeb 100644 --- a/FusionIIIT/applications/examination/api/views.py +++ b/FusionIIIT/applications/examination/api/views.py @@ -2326,7 +2326,7 @@ def generate_student_result_pdf(self, request): subtitle_style = ParagraphStyle( 'Subtitle', - parent=styles['Normal'], + parent=styles['Heading2'], fontSize=11, spaceAfter=6, alignment=1, # Center @@ -2334,8 +2334,8 @@ def generate_student_result_pdf(self, request): ) # Institution Header - story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style)) - story.append(Paragraph("Manufacturing, Jabalpur", title_style)) + story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style)) + story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style)) story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style)) story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style)) story.append(Spacer(1, 20)) @@ -3474,7 +3474,8 @@ def post(self, request): 'Title', parent=styles['Heading1'], fontSize=14, - spaceAfter=8, + spaceAfter=2, + leading=18, alignment=1, # Center fontName='Times-Bold' ) @@ -3501,10 +3502,10 @@ def post(self, request): logo = Image(logo_path, width=0.8*inch, height=0.8*inch) # Create separate paragraphs for better text formatting - title_para = Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style) - subtitle1_para = Paragraph("Manufacturing, Jabalpur", title_style) + title_para = Paragraph("PDPM Indian Institute of Information Technology,", title_style) + subtitle1_para = Paragraph("Design & Manufacturing, Jabalpur", title_style) subtitle2_para = Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style) - subtitle3_para = Paragraph("Semester Grade Report / Marksheet", subtitle_style) + subtitle3_para = Paragraph("Semester Grade Report / Marksheet", subtitle_style) # Create header table with logo and text header_table_data = [ @@ -3523,16 +3524,16 @@ def post(self, request): story.append(header_table) else: # No logo, just text - story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style)) - story.append(Paragraph("Manufacturing, Jabalpur", title_style)) + story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style)) + story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style)) story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style)) - story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style)) + story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style)) except Exception as e: # If logo fails, continue with text only - story.append(Paragraph("PDPM Indian Institute of Information Technology, Design &", title_style)) - story.append(Paragraph("Manufacturing, Jabalpur", title_style)) + story.append(Paragraph("PDPM Indian Institute of Information Technology,", title_style)) + story.append(Paragraph("Design & Manufacturing, Jabalpur", title_style)) story.append(Paragraph("(An Institute of National Importance under MoE, Govt. of India)", subtitle_style)) - story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style)) + story.append(Paragraph("Semester Grade Report / Marksheet", subtitle_style)) story.append(Spacer(1, 12)) From fb35b7b3585d564b00d6fcb020e12184d89e4792 Mon Sep 17 00:00:00 2001 From: vikrantwiz02 Date: Fri, 5 Dec 2025 15:36:14 +0530 Subject: [PATCH 2/2] Adjust column widths in student result PDF table for better layout --- FusionIIIT/applications/examination/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FusionIIIT/applications/examination/api/views.py b/FusionIIIT/applications/examination/api/views.py index 4a635cbeb..b7114c091 100644 --- a/FusionIIIT/applications/examination/api/views.py +++ b/FusionIIIT/applications/examination/api/views.py @@ -3552,7 +3552,7 @@ def post(self, request): [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)] ] - student_table = Table(student_data, colWidths=[1.75*inch, 1.75*inch, 1.75*inch, 1.75*inch]) + student_table = Table(student_data, colWidths=[1.14*inch, 3.56*inch, 1.3*inch, 1.0*inch]) student_table.setStyle(TableStyle([ ('FONTNAME', (0, 0), (-1, -1), 'Times-Roman'), ('FONTSIZE', (0, 0), (-1, -1), 10),