""" PDF Export - Constants and ReportLab styles for Abiturkorrektur PDFs. """ from reportlab.lib import colors from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle # ============================================= # CONSTANTS # ============================================= GRADE_POINTS_TO_NOTE = { 15: "1+", 14: "1", 13: "1-", 12: "2+", 11: "2", 10: "2-", 9: "3+", 8: "3", 7: "3-", 6: "4+", 5: "4", 4: "4-", 3: "5+", 2: "5", 1: "5-", 0: "6" } CRITERIA_DISPLAY_NAMES = { "rechtschreibung": "Sprachliche Richtigkeit (Rechtschreibung)", "grammatik": "Sprachliche Richtigkeit (Grammatik)", "inhalt": "Inhaltliche Leistung", "struktur": "Aufbau und Struktur", "stil": "Ausdruck und Stil" } CRITERIA_WEIGHTS = { "rechtschreibung": 15, "grammatik": 15, "inhalt": 40, "struktur": 15, "stil": 15 } # ============================================= # STYLES # ============================================= def get_custom_styles(): """Create custom paragraph styles for Gutachten.""" styles = getSampleStyleSheet() # Title style styles.add(ParagraphStyle( name='GutachtenTitle', parent=styles['Heading1'], fontSize=16, spaceAfter=12, alignment=TA_CENTER, textColor=colors.HexColor('#1e3a5f') )) # Subtitle style styles.add(ParagraphStyle( name='GutachtenSubtitle', parent=styles['Heading2'], fontSize=12, spaceAfter=8, spaceBefore=16, textColor=colors.HexColor('#2c5282') )) # Section header styles.add(ParagraphStyle( name='SectionHeader', parent=styles['Heading3'], fontSize=11, spaceAfter=6, spaceBefore=12, textColor=colors.HexColor('#2d3748'), borderColor=colors.HexColor('#e2e8f0'), borderWidth=0, borderPadding=0 )) # Body text styles.add(ParagraphStyle( name='GutachtenBody', parent=styles['Normal'], fontSize=10, leading=14, alignment=TA_JUSTIFY, spaceAfter=6 )) # Small text for footer/meta styles.add(ParagraphStyle( name='MetaText', parent=styles['Normal'], fontSize=8, textColor=colors.grey, alignment=TA_LEFT )) # List item styles.add(ParagraphStyle( name='ListItem', parent=styles['Normal'], fontSize=10, leftIndent=20, bulletIndent=10, spaceAfter=4 )) return styles