def __init__(self, title=u"Reporte", author=u"Enlaces", subject=u"Reporte", keywords=u"Python", creator=u"Reportlab", img_path=None, user=None, odate=None, otime=None, portrait=True): self.config = _getLocals(locals()) self.config.update( dict(lang='ES', leftMargin=2.5 * _cm, rightMargin=1.5 * _cm, topMargin=2 * _cm, bottomMargin=1.8 * _cm, pagesize=_portrait(_LETTER) if portrait else _landscape(_LETTER), pageCompression=1)) self.elements = list()
def __init__(self, title=u"Reporte", author=u"Enlaces", subject=u"Reporte", keywords=u"Python", creator=u"Reportlab", img_path=None, user=None, odate=None, otime=None, portrait=True): self.config = _getLocals(locals()) self.config.update(dict(lang='ES', leftMargin=2.5*_cm, rightMargin=1.5*_cm, topMargin=2*_cm, bottomMargin=1.8*_cm, pagesize = _portrait(_LETTER) if portrait else _landscape(_LETTER), pageCompression=1)) self.elements = list()
#_style = _getSampleStyleSheet() # portrait vars _ppagesize = _portrait(_LETTER) _ppw, _pph = _ppagesize _p_vars = cdict( imgxy = dict(x=.5*_cm, y=4*_cm, anchor="c"), #hline = dict(x1=2.5*_cm, y1=_pph-(1.94*_cm), x2=_ppw-(1.5*_cm), y2=_pph-(1.94*_cm)), vline = dict(x1=2*_cm, y1=1.5*_cm, x2=2*_cm, y2=_pph-(1.94*_cm)), ctitle = dict(x=(_ppw/2.0)+(.5*_cm), y=_pph-(1.94*_cm)), date_time = dict(x=_ppw/2.0, y=1.5*_cm), page_count = dict(x=_ppw-(1.5*_cm), y=1.5*_cm), brand_name = dict(x=_pph-(7.94*_cm), y=-1.15*_cm), ) # end portrait # landscape vars _lpagesize = _landscape(_LETTER) _lpw, _lph = _lpagesize _l_vars = cdict( imgxy = dict(x=5*_cm, y=2*_cm, width=18*_cm, height=18*_cm, anchor="c"), #hline = dict(x1=2.5*_cm, y1=_lph-(1.94*_cm), x2=_lpw-(1.5*_cm), y2=_lph-(1.94*_cm)), vline = dict(x1=2*_cm, y1=1.5*_cm, x2=2*_cm, y2=_lph-(1.94*_cm)), ctitle = dict(x=(_lpw/2.0)+(.5*_cm), y=_lph-(1.94*_cm)), date_time = dict(x=_lpw/2.0, y=1.5*_cm), page_count = dict(x=_lpw-(1.5*_cm), y=1.5*_cm), brand_name = dict(x=_lph-(7.94*_cm), y=-1.15*_cm), ) # end landscape _choice_page = lambda flag: _p_vars if flag else _l_vars _tbstyle = _TableStyle([ ('GRID', (0,0), (-1,-1), .01*_cm, _colors.Color(.8,.8,.8)), ('ALIGN', (0,0), (-1,-1), 'CENTER'),
#_style = _getSampleStyleSheet() # portrait vars _ppagesize = _portrait(_LETTER) _ppw, _pph = _ppagesize _p_vars = cdict( imgxy=dict(x=.5 * _cm, y=4 * _cm, anchor="c"), #hline = dict(x1=2.5*_cm, y1=_pph-(1.94*_cm), x2=_ppw-(1.5*_cm), y2=_pph-(1.94*_cm)), vline=dict(x1=2 * _cm, y1=1.5 * _cm, x2=2 * _cm, y2=_pph - (1.94 * _cm)), ctitle=dict(x=(_ppw / 2.0) + (.5 * _cm), y=_pph - (1.94 * _cm)), date_time=dict(x=_ppw / 2.0, y=1.5 * _cm), page_count=dict(x=_ppw - (1.5 * _cm), y=1.5 * _cm), brand_name=dict(x=_pph - (7.94 * _cm), y=-1.15 * _cm), ) # end portrait # landscape vars _lpagesize = _landscape(_LETTER) _lpw, _lph = _lpagesize _l_vars = cdict( imgxy=dict(x=5 * _cm, y=2 * _cm, width=18 * _cm, height=18 * _cm, anchor="c"), #hline = dict(x1=2.5*_cm, y1=_lph-(1.94*_cm), x2=_lpw-(1.5*_cm), y2=_lph-(1.94*_cm)), vline=dict(x1=2 * _cm, y1=1.5 * _cm, x2=2 * _cm, y2=_lph - (1.94 * _cm)), ctitle=dict(x=(_lpw / 2.0) + (.5 * _cm), y=_lph - (1.94 * _cm)), date_time=dict(x=_lpw / 2.0, y=1.5 * _cm), page_count=dict(x=_lpw - (1.5 * _cm), y=1.5 * _cm), brand_name=dict(x=_lph - (7.94 * _cm), y=-1.15 * _cm), ) # end landscape