reportlab 生成pdf
使用from reportlab.lib.styles import getSampleStyleSheet
产生基础格式。
如何修改需要的格式:
styles = getSampleStyleSheet()
style.normal = copy.deepcopy(styles['Normal'])
style.normal.alignment = 4
style.normal.fontName = '%s' % self.style.fontName
style.normal.fontSize = self.style.fontSize
style.normal.firstLineIndent = 0.4 * cm
style.normal.spaceBefore = self.style.fontSize * 1.5
# normal.textColor = '#0e2b58'
如何画表格:
from reportlab.platypus import Table
Table(table_list, hAlign='LEFT', style=[('GRID',(0,0),(-1,-1),0.5,colors.black)])
参考:
[1] https://www.programcreek.com/python/example/58583/reportlab.lib.styles.getSampleStyleSheet
[2] https://www.programcreek.com/python/?code=salan668%2FFAE%2FFAE-master%2FFAE%2FDescription%2FMyPDFDocument.py#
[3] https://github.com/salan668/FAE
[4] https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0237587&type=printable
[5] https://docs.reportlab.com/reportlab/userguide/ch7_tables/