reportlab中文显示问题

引入库

from reportlab.lib.pagesizes import letter from reportlab.platypus import SimpleDocTemplate, Table, TableStyle from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFontfrom from reportlab.lib import fonts,colors

加载字体

fonts.addMapping('simsun', 0, 0, 'simsun')

设置中文字体

ts = [('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), ('BOX', (0, 0), (-1, -1), 0.25, colors.black), ('FONT', (0, 0), (-1, -1), 'simsun')] t = Table(table_data_pdf,2.1*inch, 0.24*inch, ts)

你可能感兴趣的:(reportlab中文显示问题)