当前位置: 首页>>代码示例>>Python>>正文


Python canvas.beginText函数代码示例

本文整理汇总了Python中reportlab.pdfgen.canvas.beginText函数的典型用法代码示例。如果您正苦于以下问题:Python beginText函数的具体用法?Python beginText怎么用?Python beginText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了beginText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: myFirstPage

    def myFirstPage(canvas, doc):
        PAGE_HEIGHT,PAGE_WIDTH = letter
        canvas.saveState()
        canvas.drawImage(fondo, 0,0, PAGE_HEIGHT, PAGE_WIDTH )
        canvas.setStrokeColorRGB(1,0,1,alpha=0.1)
        #canvas.setPageSize(landscape(letter))
        canvas.setFont('Arial', 8)
        canvas.drawString(132,670, cuenta_cobro.periodo)
        canvas.drawString(475, 670, cuenta_cobro.num_cuota)
        canvas.drawString(132, 653, cuenta_cobro.fecha_transaccion)
        canvas.drawString(132, 633,  cuenta_cobro.no_contrato)

        seguridad_social = "Adjunto planilla de pago de Seguridad social No %s " % (cuenta_cobro.num_planilla_ss,)
        seguridad_social = seguridad_social + " correspondiente a los aportes del mes de %s, en los terminos legales." % (cuenta_cobro.mes_planilla_ss)
        #canvas.drawString(132, 300,textwrap.fill(seguridad_social, 90)  )
        cuenta_cobro.informe_actividades_periodo = textwrap.fill(cuenta_cobro.informe_actividades_periodo, 105)

        textobject = canvas.beginText()
        textobject.setTextOrigin(132, 609)
        textobject.textLines(cuenta_cobro.informe_actividades_periodo)
        canvas.drawText(textobject)

        textobject = canvas.beginText()
        textobject.setTextOrigin(132, 240)
        textobject.textLines(textwrap.fill(seguridad_social, 105))
        canvas.drawText(textobject)

        #canvas.drawString(132, 292,  "correspondiente a los aportes del mes de %s, en los terminos legales." % (cuenta_cobro.mes_planilla_ss))

        canvas.drawCentredString(170, 90, cuenta_cobro.nombre_interventor)
        canvas.drawCentredString(170, 81, "INTERVENTOR/SUPERVISOR %s" % (cuenta_cobro.cargo_interventor,))

        canvas.drawCentredString(415, 90, cuenta_cobro.nombre_beneficiario)
        canvas.drawCentredString(415, 81, "C.C. No. %s de %s" % (cuenta_cobro.documento_beneficiario, cuenta_cobro.lugar_exp_doc_beneficiario))


        SHOW_GRID = False
        if SHOW_GRID:
             n = 5
             s = 200
             #canvas.setStrokeGray(0.90)
             #canvas.setFillGray(0.90)
             canvas.setStrokeColorRGB(0,1,1,alpha=0.1)

             canvas.setFillColorRGB(1,0,1)
             canvas.setFont('Arial',1)
             for x in range(s):
                for y in range(s):
                   canvas.rect(x*n,y*n, width=n, height=n, stroke=1)
                   canvas.drawString(x*n,y*n,"%s,%s" % ((x*n),(y*n)) )
        canvas.restoreState()
开发者ID:luissalamanca22,项目名称:dubs_django,代码行数:51,代码来源:services.py

示例2: _add_text

 def _add_text(self, text, canvas, coords):
     textobject = canvas.beginText(*coords)
     textobject.setFont("Helvetica", 14)
     text = text.replace('\r', '\n').replace('\n\n', '\n')
     for line in text.split('\n'):
         textobject.textLine(line.strip())
     canvas.drawText(textobject)
开发者ID:helfenberg,项目名称:adress_couverts,代码行数:7,代码来源:pdf_template.py

示例3: __init__

    def __init__(self, canvas, x, y, width, height, font='Helvetica',
        fontsize=11, align='left', lineheight=1, move_cursor=False):

        # Make sure these values aren't strings
        fontsize = float(fontsize)
        lineheight = float(lineheight)

        self.canvas = canvas
        self.font = font
        self.fontsize = fontsize
        self.align = align
        self.x = x
        self.y = y
        self.height = height
        self.width = width
        self.move_cursor = move_cursor

        # Regular lineheight
        self.lineheight = fontsize / 72.0 * units.inch
        self.first_line = y + height - self.lineheight

        # Adjusted lineheight
        self.lineheight *= lineheight

        self.text = canvas.beginText()
        self.text.setTextOrigin(x, self.first_line)
        self.space_width = canvas.stringWidth(' ', font, fontsize)
开发者ID:dbrgn,项目名称:pypdfml,代码行数:27,代码来源:pypdfml.py

示例4: __init__

    def __init__(self, canvas, x, y, width, height=0, font=FONT,
        fontsize=FONTSIZE, align=ALIGN, lineheight=LINEHEIGHT, move_cursor=False):

        # Make sure these values aren't strings
        fontsize = float(fontsize)
        lineheight = float(lineheight)

        self.canvas = canvas
        self.font = font
        self.fontsize = fontsize
        self.align = align
        self.x = x
        self.y = y
        self.width = width
        self.move_cursor = move_cursor

        # Lineheight
        self.lineheight = fontsize * lineheight

        # If height was specified. Start 1 line below.
        self.first_line = y
        if height:
            self.first_line += height - self.lineheight

        self.text = canvas.beginText()

        # Set font
        self.text.setFont(self.font, self.fontsize)

        self.text.setTextOrigin(x, self.first_line)
        self.space_width = canvas.stringWidth(' ', font, fontsize)
开发者ID:Cuahutli,项目名称:pypdfml,代码行数:31,代码来源:pypdfml.py

示例5: print_line

def print_line(canvas, y, fontsize, line, force=False):
    """Prints one line of text on the left-hand side of the label.

    :param canvas: ReportLab canvas object
    :param y: vertical coordinate of the lower left corner of the printed text.
        Note that the origin of the coordinate system is the lower left of the
        paper.
    :param fontsize: font size of the text
    :param line: the text to be printed; it must not contain line breaks
    :param force: whether `ExcessException` should be raised if the text has to
        be compressed too much; if ``True``, the text may be compressed as much
        as necessary

    :type canvas: canvas.Canvas
    :type y: float
    :type fontsize: float
    :type line: unicode
    :type force: bool

    :raises ExcessException: if the line is too long and `force` is ``False``
    """
    textobject = canvas.beginText()
    textobject.setFont(institute.reportlab_config.default_fontname, fontsize)
    width = canvas.stringWidth(line, institute.reportlab_config.default_fontname, fontsize)
    excess = width / max_width_text
    if excess > 2 and not force:
        raise ExcessException
    elif excess > 1:
        textobject.setHorizScale(100 / excess)
    textobject.setTextOrigin(horizontal_margin, y + vertical_margin + vertical_relative_offset * fontsize)
    textobject.textOut(line)
    canvas.drawText(textobject)
开发者ID:muescha,项目名称:juliabase,代码行数:32,代码来源:printer_labels.py

示例6: draw_due_date

    def draw_due_date(self, canvas, due_date):
        """Draw due date. This will probably be ignored by quite a few but..."""

        textobject = canvas.beginText()
        textobject.setTextOrigin(170*mm, 95*mm)
        textobject.setFont(self.FONT, 10)
        textobject.textLine(due_date)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:8,代码来源:giro.py

示例7: draw_account_no

    def draw_account_no(self, canvas, account):
        """Draw the account no"""

        textobject = canvas.beginText()
        textobject.setTextOrigin(133*mm, 2.13*cm)
        textobject.setFont(self.BOLDFONT, 10)
        textobject.textLine(account)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:8,代码来源:giro.py

示例8: draw_payment_info

    def draw_payment_info(self, canvas, info):
        """Add payment information. This will probably be copied and pasted by the member"""

        textobject = canvas.beginText()
        textobject.setTextOrigin(1.5*cm, 9.0*cm)
        textobject.setFont(self.BOLDFONT, 10)
        textobject.textLine(info)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:8,代码来源:giro.py

示例9: draw_address

def draw_address(canvas):
    """ Draws the business address """

    canvas.setFont('Helvetica', 9)
    textobject = canvas.beginText(13 * cm, -2.5 * cm)
    for line in business_details:
        textobject.textLine(line)
    canvas.drawText(textobject)
开发者ID:ses4j,项目名称:ts,代码行数:8,代码来源:invoice.py

示例10: draw_address_heading

    def draw_address_heading(self, canvas, address):
        """Draw member's address at the top of the page."""

        textobject = canvas.beginText()
        textobject.setTextOrigin(2.0*cm, 24.5*cm)
        textobject.setFont(self.FONT, 12)
        for line in address.split('\n'):
            textobject.textLine(line)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:9,代码来源:giro.py

示例11: contactleftLaterPages

def contactleftLaterPages(canvas):
	textobject = canvas.beginText()
	textobject.setTextOrigin(51.2,57)
	textobject.setFont('Akkurat-Light',9)
	textobject.textLines('''
	510 Victoria Ave
	Venice CA 90291
	www.leftfieldlabs.com
	''')
	canvas.drawText(textobject)
开发者ID:codedcolors,项目名称:pdfmkr,代码行数:10,代码来源:makepdf.py

示例12: draw_payers_address

    def draw_payers_address(self, canvas, address):
        """Draw member's address at the bottom"""

        textobject = canvas.beginText()
        textobject.setTextOrigin(1.5*cm, 5.8*cm)
        textobject.setFont(self.FONT, 10)
        address = address.replace('\r','')
        for line in address.split('\n'):
            textobject.textLine(line)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:10,代码来源:giro.py

示例13: draw_amount

    def draw_amount(self, canvas, amount):
        """Draw the amount to be paid"""

        textobject = canvas.beginText()
        textobject.setTextOrigin(92*mm, 2.13*cm)
        textobject.setFont(self.BOLDFONT, 10)
        textobject.textLine(amount)
        textobject.setTextOrigin(107*mm, 2.13*cm)
        textobject.textLine('00')
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:10,代码来源:giro.py

示例14: lfleft

def lfleft(canvas):
	textobject = canvas.beginText()
	textobject.setTextOrigin(51.2,749)
	textobject.setFont('Gridnik',27)
	textobject.textLines('''
	LEFT 
	FIELD 
	LABS
	''')
	canvas.drawText(textobject)
开发者ID:codedcolors,项目名称:lflpdf,代码行数:10,代码来源:makesow.py

示例15: draw_recipient_address

    def draw_recipient_address(self, canvas, address):
        """Draw the club's address"""

        textobject = canvas.beginText()
        textobject.setTextOrigin(11.5*cm, 5.8*cm)
        textobject.setFont(self.FONT, 10)
        address=address.replace('\r', '')
        for line in address.split('\n'):
            textobject.textLine(line)
        canvas.drawText(textobject)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:10,代码来源:giro.py


注:本文中的reportlab.pdfgen.canvas.beginText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。