Невозможно выделить текст в Reportlab - PullRequest
0 голосов
/ 12 сентября 2018

У меня есть эта программа:

from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle

doc = SimpleDocTemplate("form_letter.pdf", pagesize=letter,
                        rightMargin=72, leftMargin=72,
                        topMargin=72, bottomMargin=18)
Story = []
styles = getSampleStyleSheet()
styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY,
                          fontSize=45, leading=40, fontName="Times-Roman"))
ptext = '\t\tWe        would      like      to    welcome         you to our subscriber base for Magazine! \
        You will <font backcolor=green>receive</font> issues at<font size=24 color=blue name=courier backcolor=red> the excellent introductory price </font>of. Please respond by\
        to start receiving your subscription and get the following free gift.'
Story.append(Paragraph(ptext, styles["Justify"]))

doc.build(Story)

Когда я запускаю ее, она делает это pdf:

screenshot of output

Почему этовыделить так ужасно?И как это сделать правильно?

...