本文整理汇总了Python中reportlab.lib.enums.TA_CENTER属性的典型用法代码示例。如果您正苦于以下问题:Python enums.TA_CENTER属性的具体用法?Python enums.TA_CENTER怎么用?Python enums.TA_CENTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类reportlab.lib.enums
的用法示例。
在下文中一共展示了enums.TA_CENTER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def __init__(self):
super(TopoPagina, self).__init__()
self.elements = []
txt = SystemField(expression='%(report_title)s', top=0.65 *
cm, left=0 * cm, width=19.4 * cm, height=0.8 * cm)
txt.style = {'fontName': REPORT_FONT_BOLD,
'fontSize': 15, 'alignment': TA_CENTER, 'leading': 15}
self.elements.append(txt)
txt = SystemField(expression='Página %(page_number)s de %(last_page_number)s',
top=3.1 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT, 'fontSize': 8.5,
'alignment': TA_RIGHT, 'leading': 8.5}
self.elements.append(txt)
self.elements.append(Line(top=3.6 * cm, bottom=3.6 *
cm, left=0 * cm, right=19.4 * cm, stroke_width=0.3))
self.height = 3.65 * cm
示例2: wrap
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def wrap(self, availWidth, availHeight):
# try to get the caption aligned
if self.caption:
self._getCaptionPara()
w, h = self.captionPara.wrap(self.width, availHeight - self.figureHeight)
self.captionHeight = h + self.captionGap
self.height = self.captionHeight + self.figureHeight
if w>self.width: self.width = w
else:
self.height = self.figureHeight
if self.hAlign in ('CENTER','CENTRE',TA_CENTER):
self.dx = 0.5 * (availWidth - self.width)
elif self.hAlign in ('RIGHT',TA_RIGHT):
self.dx = availWidth - self.width
else:
self.dx = 0
return (self.width, self.height)
示例3: __init__
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def __init__(self):
super(Cabecalho, self).__init__()
self.elements = []
fld = self.inclui_campo_sem_borda(nome='razao_social', conteudo=u'NFe.razao_social_formatado', top=0*cm, left=0.3*cm, width=7.6*cm, height=0.5*cm)
fld.style = {'fontName': FONTE_NFCE_NEGRITO, 'fontSize': FONTE_TAMANHO_9}
fld = self.inclui_campo_sem_borda(nome='emitente', conteudo=u'NFe.cnpj_com_label_formatado', top=0.5*cm, left=0.3*cm, width=7.6*cm, height=0.5*cm)
fld.style = {'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7}
fld = self.inclui_campo_sem_borda(nome='endereco_emitente', conteudo=u'NFe.endereco_emitente_nfce_formatado', top=1*cm, left=0.3*cm, width=7.6*cm, height=0.5*cm)
fld.style = {'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7}
txt = self.inclui_texto_sem_borda(nome='danfe_ext', texto=u'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', top=1.6*cm, left=0*cm, width=7.6*cm, height=1*cm)
txt.style = {'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_9, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_9}
self.height = 2.6*cm
示例4: _getCaptionPara
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def _getCaptionPara(self):
caption = self.caption
captionFont = self.captionFont
captionSize = self.captionSize
captionTextColor = self.captionTextColor
captionBackColor = self.captionBackColor
if self._captionData!=(caption,captionFont,captionSize,captionTextColor,captionBackColor):
self._captionData = (caption,captionFont,captionSize,captionTextColor,captionBackColor)
self.captionStyle = ParagraphStyle(
'Caption',
fontName=captionFont,
fontSize=captionSize,
leading=1.2*captionSize,
textColor = captionTextColor,
backColor = captionBackColor,
#seems to be getting ignored
spaceBefore=self.captionGap or 0.5*captionSize,
alignment=TA_CENTER)
#must build paragraph now to get sequencing in synch with rest of story
self.captionPara = Paragraph(self.caption, self.captionStyle)
示例5: drawOn
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def drawOn(self, canv, x, y, _sW=0):
if _sW > 0 and hasattr(self, 'hAlign'):
a = self.hAlign
if a in ('CENTER', 'CENTRE', TA_CENTER):
x += 0.5 * _sW
elif a in ('RIGHT', TA_RIGHT):
x += _sW
elif a not in ('LEFT', TA_LEFT):
raise ValueError("Bad hAlign value " + str(a))
xobj = self.xobj
xobj_name = makerl(canv._doc, xobj)
xscale = self.drawWidth / self._imgw
yscale = self.drawHeight / self._imgh
canv.saveState()
canv.translate(x, y)
canv.scale(xscale, yscale)
canv.doForm(xobj_name)
canv.restoreState()
示例6: drawOn
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def drawOn(self, canv, x, y, _sW=0, width=0, height=0):
if _sW > 0 and hasattr(self, 'hAlign'):
a = self.hAlign
if a in ('CENTER', 'CENTRE', TA_CENTER):
x += 0.5 * _sW
elif a in ('RIGHT', TA_RIGHT):
x += _sW
elif a not in ('LEFT', TA_LEFT):
raise ValueError("Bad hAlign value " + str(a))
xobj = self.xobj
xobj_name = makerl(canv._doc, xobj)
xscale = (width or self.drawWidth) / xobj.w
yscale = (height or self.drawHeight) / xobj.h
x -= xobj.x * xscale
y -= xobj.y * yscale
canv.saveState()
canv.translate(x, y)
canv.scale(xscale, yscale)
canv.doForm(xobj_name)
canv.restoreState()
示例7: __init__
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def __init__(self, pdf_components):
self.style = getSampleStyleSheet()
self.style['Normal'].leading = 16
self.style.add(ParagraphStyle(name='centered', alignment=TA_CENTER))
self.style.add(ParagraphStyle(name='centered_wide', alignment=TA_CENTER,
leading=18))
self.style.add(ParagraphStyle(name='section_body',
parent=self.style['Normal'],
spaceAfter=inch * .05,
fontSize=11))
self.style.add(ParagraphStyle(name='bullet_list',
parent=self.style['Normal'],
fontSize=11))
if six.PY3:
self.buffer = six.BytesIO()
else:
self.buffer = six.StringIO()
self.firstPage = True
self.document = SimpleDocTemplate(self.buffer, pagesize=letter,
rightMargin=12.7 * mm, leftMargin=12.7 * mm,
topMargin=120, bottomMargin=80)
self.tlp_color = pdf_components.get('tlp_color', '')
self.pdf_components = pdf_components
self.pdf_list = []
示例8: inserir_data_emissao
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def inserir_data_emissao(self, data_emissao):
if data_emissao:
txt = ObjectValue(attribute_name='format_data_emissao', display_format='Data: %s',
top=1.45 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm)
else:
txt = SystemField(expression='Data: %(now:%d/%m/%Y)s',
top=1.45 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT_BOLD,
'fontSize': 9, 'alignment': TA_CENTER, 'leading': 9}
self.elements.append(txt)
示例9: inserir_data_validade
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def inserir_data_validade(self, data_validade):
if data_validade:
txt = ObjectValue(attribute_name='format_data_vencimento', display_format='Válido até: %s',
top=2.05 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT_BOLD,
'fontSize': 9, 'alignment': TA_CENTER, 'leading': 9}
self.elements.append(txt)
示例10: inserir_data_entrega
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def inserir_data_entrega(self, data_entrega):
if data_entrega:
txt = ObjectValue(attribute_name='format_data_entrega', display_format='Data de entrega: %s',
top=2.05 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT_BOLD,
'fontSize': 9, 'alignment': TA_CENTER, 'leading': 9}
self.elements.append(txt)
示例11: inserir_nome_empresa
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def inserir_nome_empresa(self, nome):
txt = Label(text=nome, top=0 * cm, left=0 * cm,
width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT, 'fontSize': 9,
'alignment': TA_CENTER, 'leading': 9}
self.elements.append(txt)
示例12: inserir_telefone_empresa
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def inserir_telefone_empresa(self, telefone):
if self.ender_info:
top = 1 * cm
else:
top = 0.5 * cm
txt = Label(text=telefone, top=top, left=0 * cm,
width=19.4 * cm, height=0.5 * cm)
txt.style = {'fontName': REPORT_FONT, 'fontSize': 9,
'alignment': TA_CENTER, 'leading': 9}
self.elements.append(txt)
示例13: __init__
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def __init__(self, invoice_path, pdf_info=None, precision='0.01'):
if not pdf_info:
pdf_info = self.default_pdf_info
SimpleDocTemplate.__init__(
self,
invoice_path,
pagesize=letter,
rightMargin=inch,
leftMargin=inch,
topMargin=inch,
bottomMargin=inch,
**pdf_info.__dict__
)
self.precision = precision
self._defined_styles = getSampleStyleSheet()
self._defined_styles.add(
ParagraphStyle('RightHeading1', parent=self._defined_styles.get('Heading1'), alignment=TA_RIGHT)
)
self._defined_styles.add(
ParagraphStyle('TableParagraph', parent=self._defined_styles.get('Normal'), alignment=TA_CENTER)
)
self.invoice_info = None
self.service_provider_info = None
self.client_info = None
self.is_paid = False
self._items = []
self._item_tax_rate = None
self._transactions = []
self._story = []
self._bottom_tip = None
self._bottom_tip_align = None
示例14: set_bottom_tip
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def set_bottom_tip(self, text, align=TA_CENTER):
self._bottom_tip = text
self._bottom_tip_align = align
示例15: _hAlignAdjust
# 需要导入模块: from reportlab.lib import enums [as 别名]
# 或者: from reportlab.lib.enums import TA_CENTER [as 别名]
def _hAlignAdjust(self,x,sW=0):
if sW and hasattr(self,'hAlign'):
a = self.hAlign
if a in ('CENTER','CENTRE', TA_CENTER):
x += 0.5*sW
elif a in ('RIGHT',TA_RIGHT):
x += sW
elif a not in ('LEFT',TA_LEFT):
raise ValueError("Bad hAlign value "+str(a))
return x