python reportlab为Listitem提供格式

2024-09-28 03:18:13 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在python中向带编号的reportlab PDF添加字符。示例:

  1. 第一个元素
  2. 第二个要素是这个

其他:
a) 第一项
b) 一秒钟

如何添加“.”、“)”、“-”,我曾运行过:

Myitems.append(ListFlowable([  
    ListItem(Paragraph("text", styleLeft),  
    leftIndent=20)],   
    bulletType='a', leftIndent=20, start=1))

Tags: text元素示例pdf字符编号要素reportlab
1条回答
网友
1楼 · 发布于 2024-09-28 03:18:13
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

doc = SimpleDocTemplate("form_letter.pdf",pagesize=letter,
                        rightMargin=72,leftMargin=72,
                        topMargin=72,bottomMargin=18)

styles = getSampleStyleSheet()

Story=[]

ptext = '''
<seq>) </seq>Some Text<br/>
<seq>) </seq>Some more test Text
'''
Story.append(Paragraph(ptext, styles["Bullet"]))

doc.build(Story)

相关问题 更多 >

    热门问题