コード例 #1
0
def createBullet(c, text, x, y, font, size, indent=0):
    """ Function to create a Bullet Point """
    styles = getSampleStyleSheet()
    style = styles["Normal"]
    if indent != 0:
        t = ListFlowable([Paragraph(text, style)],
                         bulletType='bullet',
                         start='circle',
                         leftIndent=indent,
                         fontName=font,
                         bulletFontName="Helvetica",
                         bulletFontSize=8,
                         bulletAnchor="Start")
    else:
        t = ListFlowable([Paragraph(text, style)],
                         bulletType='bullet',
                         start='circle',
                         fontName=font,
                         bulletFontName="Helvetica",
                         bulletFontSize=8,
                         bulletAnchor="Start")
    t.wrapOn(c, 480, 20)
    t.drawOn(c, x, y)
    return y - size
コード例 #2
0
def create_list(canvas, starting_height, starting_x, max_width, list, style):
    bullet_list = []
    for item in list['data']:
        bullet_list.append(Paragraph(item, style=style))
    list = ListFlowable(bullet_list,
                        bulletType='bullet',
                        start='bulletchar',
                        bulletFontName='Times-Roman',
                        bulletFontSize=16,
                        style=list_style)

    w1, h1 = list.wrapOn(canvas, max_width, MAX_HEIGHT)
    if starting_height - h1 < 0:
        canvas.showPage()
        starting_height = TOP_PADDING

    list.drawOn(canvas, starting_x - w1, starting_height - h1)

    return starting_height - h1