[Answered ]-SetFont in ReportLab, Django

2👍

May by you can create your own style and use it everywhere? As example:

styles = getSampleStyleSheet()
    styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY, fontName='Times', fontSize=10))
    styles.add(ParagraphStyle(name='Justify-Bold', alignment=TA_JUSTIFY, fontName='Times-Bold'))
    bold_style = styles['Justify-Bold']
    normal_style = styles['Justify']

or:

doc_title = copy.copy(styles["Heading1"])
    doc_title.alignment = TA_CENTER
    doc_title.fontName = 'Times-Bold'
    doc_title.fontSize = 16
👤Pavel

0👍

  1. Register your font:
    pdfmetrics.registerFont(TTFont('DejaVuSerif', 'DejaVuSerif.ttf'))
  1. In your TableStyle add:
    ('FONT', (0, 0), (6, 0), 'DejaVuSerif'),

Leave a comment