reportlab打印unicode字符而不是bu

2024-09-28 17:23:48 发布

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

在测试这个How can I make the bullet appear directly next to the text of an indented list in the reportlab package for python?问题中提到的示例时,将打印unicode字符而不是项目符号。在

这是我的密码。。在

# -*- coding: utf-8 -*-

from reportlab.platypus import Paragraph, ListFlowable, ListItem, SimpleDocTemplate, Frame
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import CMYKColor

doc = SimpleDocTemplate("SOtest.pdf")
styles = getSampleStyleSheet()
Story = []
Story.append(Paragraph("Header Text, I dont want the bullets directly below the H"
                       ,styles['Normal']))
style = styles['Normal']
t = ListFlowable(
        [
        # Paragraph("Item no.1", style),
        ListItem(Paragraph("Item no. 2", style),bulletColor="green",value='circle'),
        ListItem(Paragraph('sublist item 2', style),bulletColor='red',value='circle'),
        ],
        bulletType="bullet",
        start='circle',
        leftIndent=50,
)

Story.append(t)
doc.build(Story)

在生成的pdf文件中,我得到

^{pr2}$

Tags: thefromimportstylelibreportlabstorycircle