def create_daily_raport(self):
elements = []
pdfmetrics.registerFont(TTFont('polishFont', 'polishFont.ttf'))
data = [['Data', 'nr zlecenia', 'oprawki', 'soczewki', 'zadatek', 'dopłata', 'cena łączna']]
data_for_table = ['1', '2', '3', '4', '5', '6', '7']
for i in range(100):
data.append(data_for_table)
t = Table(data, 7 * [inch], len(data) * [0.4*inch])
t.setStyle(TableStyle([('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
('TEXTFONT', (0, 0), (-1, -1), 'polishFont')]))
elements.append(t)
date_to_PDF = self.date_for_PDF_name()
doc = SimpleDocTemplate("Dzienny_raport_"+date_to_PDF+".pdf", pagesize=A4, rightMargin=2 * cm, leftMargin=2 * cm,
topMargin=2 * cm, bottomMargin=2 * cm)
doc.build(elements, onFirstPage=self.create_footer, onLaterPages=self.create_footer)
我在此代码所在的文件夹中有“polishFont.ttf”。有什么建议为什么还有黑盒而不是抛光字符?
答案 0 :(得分:0)
Oke我发现了一个错误。
TEXTFONT是incorect,它应该是FONTNAME