-
Notifications
You must be signed in to change notification settings - Fork 0
/
old_report_lab.py
33 lines (27 loc) · 1.45 KB
/
old_report_lab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#-*- coding: utf8 -*-
from reportlab.platypus import Paragraph,SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import A4
import reportlab.rl_config #@UnusedImport
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfgen import canvas
from reportlab.lib.units import cm
import statistic
import logging
logging.basicConfig(filename='journal_events.log',format='%(asctime)s %(levelname)s %(message)s',level=logging.DEBUG)
class CreateRep:
def __init__(self, data):
print data
# пути к фонтам и регистрация фонта
reportlab.rl_config.TTFSearchPath='./data/fonts/'
pdfmetrics.registerFont(TTFont('Arial', './data/source_reports/arial.ttf'))
story=[] # словарь документа
styles = getSampleStyleSheet() # дефолтовые стили
# создаем объект документа с размером страницы A4
#doc=SimpleDocTemplate('test.pdf',pagesize = A4,title='sss',author=u'test')
#story.append(Paragraph(u'TEST', styles['Heading1']))
MyCanvas = canvas.Canvas('./data/source_reports/results.pdf')
MyCanvas.drawString(10*cm, 15*cm, u'Результаты оценки качества данных:')
MyCanvas.drawString(1*cm, 1*cm, '%s' % str(data))
MyCanvas.save()