• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python platypus.Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: draw_logo

    def draw_logo(self, canvas):
        """ Draw the logo on pdf according to following settings:
        logo_path: absolute path to image
        wanted_height: wanted height in mm (optional, default 20 mm)
        logo_x: x coordinate in mm (optional, default 13 mm)
        logo_y: y coordinate in mm (optional, default 55 mm)
        """
        if not self.company_logo_settings:
            return
        # Get logo settings
        logo_path = self.company_logo_settings.get('path', None)
        wanted_height = self.company_logo_settings.get('wanted_height', 20)
        logo_x = self.company_logo_settings.get('x', 13)
        logo_y = self.company_logo_settings.get('y', 55)

        # Sanity check
        if not os.access(logo_path, os.R_OK):
            return

        # get original lgo dimensions to compute ratio
        logo = utils.ImageReader(logo_path)
        width, height = logo.getSize()
        ratio = float(width) / height

        # Compute width according to wanted height
        computed_width = int(wanted_height * ratio)

        # Draw logo
        im = Image(logo_path, computed_width * mm, wanted_height * mm)
        im.drawOn(canvas, *self.coord(logo_x, logo_y))
开发者ID:Talengi,项目名称:phase,代码行数:30,代码来源:pdf.py


示例2: tradingReport

    def tradingReport(self, c):
        title = "DAILY TRADING" 
        c.setFont("Helvetica", 24)
        c.drawString(50,770, title)
        c.setFont("Helvetica", 16)
        c.drawString(50,730, "DATE :")
        c.drawString(110,730, str(today.year) + "/" + str(today.month) + "/" + str(today.day) ) # DATE
        c.line(110, 727, 185, 727)
        c.drawString(300,730, "Today's Performance :")
        c.line(465, 727, 515, 727)
        c.drawString(470,730, "4%")          # PROFIT value
        c.drawString(50,680, "Market Analysis")

        columHeight = [1*cm, 1*cm, 1*cm, 1*cm]
        t=Table(self._data, 2.5*cm, columHeight)             # The size of each cells
        t.setStyle(TableStyle([('GRID',(0,0),(-1,-1),1,colors.black),
                               ('VALIGN',(0,0),(-1,-1),'TOP')]))
                           
        t.wrapOn(c, 50,50)  
        t.drawOn(c, 50,550)     #Table Location

        c.drawString(50,500, "Intraday performance of Algorithm1")
        graph_1 = Image("example.png")
        graph_1.drawHeight = 6*cm
        graph_1.drawWidth = 17.5*cm
        #graph_1.wrapOn(c, 50,20)
        graph_1.drawOn(c,50,322)

        c.drawString(50,295, "Intraday performance of Algorithm2")
        graph_2 = Image("example2.png")
        graph_2.drawHeight = 6*cm
        graph_2.drawWidth = 17.5*cm
        #graph_2.wrapOn(c, 50,20)
        graph_2.drawOn(c,50,117)
开发者ID:kykk0010,项目名称:TradingSystem,代码行数:34,代码来源:dailyReport.py


示例3: __init__

    def __init__(self, filename, width=None, height=None, kind='absolute',
                 mask='auto', lazy=1, hAlign='CENTER', vAlign='CENTER'):

        try:
            super(BackgroundImage, self).__init__(
                filename=filename,
                width=width,
                height=height,
                kind=kind,
                mask=mask,
                lazy=lazy,
                hAlign=hAlign)
        except TypeError:
            # old style calling of parent
            # this is still used by reportlab
            Image.__init__(
                self,
                filename=filename,
                width=width,
                height=height,
                kind=kind,
                mask=mask,
                lazy=lazy,
                hAlign=hAlign)

        self.vAlign = vAlign
开发者ID:vikingco,项目名称:django-pdfgen,代码行数:26,代码来源:flowables.py


示例4: draw

 def draw(self):
     canvas = self.canv
     h, w = float(self.img.height), float(self.img.width)
     if not self.img.iptc.caption:
         fsz = 5.0
     else:
         fsz = 0.85*inch
     if w > h*1.3:
         fsz = 0.25*inch
     s = self.size - fsz
     if h > w:
         ratio = w / h
         h = s
         w = s * ratio
     else:
         ratio = h / w
         w = s
         h = s * ratio
     img = Image(self.img.path, height=h, width=w)
     w, h = img.wrap(w, h)
     iw, ih = w, h
     imgx, imgy = (self.size - s - (fsz/2.0), self.size - h)
     img.drawOn(self.canv, imgx, imgy)
     print "%.2f x %.2f (%.2f x %.2f dpi)" % (w/inch, h/inch, float(o.width) / (w/inch), float(o.height) / (h/inch) )
     p = Paragraph(self.img.iptc.caption, styleN)
     w, h = p.wrap(self.size - 10.0, 1.3*inch)
     print "Text %.2f x %.2f" % (w/inch, h/inch)
     p.drawOn(self.canv, 3.0, (imgy - h) - 3.0)
     canvas.rect(imgx, imgy, iw, ih, stroke=1, fill=0)
开发者ID:robmyers,项目名称:codebag,代码行数:29,代码来源:imagepdf.py


示例5: build_logo_y_empresa_por_separado

def build_logo_y_empresa_por_separado(dde):
    """
    Ganas de matar aumentando...
    dde es una lista con la ruta al logotipo de la empresa (o None) y una 
    serie de líneas de texto con los datos a mostrar de la empresa.
    Devuelve una imagen con el logotipo y una lista de líneas con los 
    datos de la empresa para dibujarlas (drawText) al lado.
    Si no hay logo, devuelve None y la lista de líneas.
    """
    if dde[0] != None:
        logo = Image(dde[0])
        logo.drawHeight = 2*cm * logo.drawHeight / logo.drawWidth
        logo.drawWidth = 2*cm
    else:
        logo = None
    lineas_empresa = dde[1:]
    if len(lineas_empresa) <= 3:
        while len(lineas_empresa) < 3:
            lineas_empresa.append("")
        empresa = lineas_empresa
    else:
        texto_empresa = lineas_empresa[0] + "\n" 
            #+ ". ".join(lineas_empresa[1:])
        resto_lineas = lineas_empresa[1:]
        pivot = len(resto_lineas)/2
        r1, r2 = resto_lineas[:pivot], resto_lineas[pivot:]
        texto_empresa += ". ".join(r1) + "\n" + ". ".join(r2)
        # Escuse moi, pero necesito aprovechar lo que ya hay. Un split no 
        # hace daño a nadie, si acaso "un poquito" al rendimiento.
        lineas_empresa = texto_empresa.split("\n")
    return logo, lineas_empresa
开发者ID:pacoqueen,项目名称:bbinn,代码行数:31,代码来源:albaran_porte.py


示例6: export_pdf

    def export_pdf(metadata_report_sobject):
        report_data = json.loads(metadata_report_sobject.get('report_data'))

        parser = SafeConfigParser()
        config_path = os.path.abspath(os.path.dirname(__file__))
        parser.read(config_path + '/config.ini')

        file_name = metadata_report_sobject.get('name') + '.pdf'
        save_location = parser.get('save', 'metadata_directory')

        saved_file_path = os.path.join(save_location, file_name)

        styleSheet = getSampleStyleSheet()

        I = Image(os.path.dirname(os.path.realpath(__file__)) + '/2g_logo.png')
        I.drawHeight = 1.25 * inch * I.drawHeight / I.drawWidth
        I.drawWidth = 1.25 * inch

        top_address_paragraph = Paragraph('<strong>2G Digital Post, Inc.</strong>', styleSheet["BodyText"])

        address_table_data = [
            [top_address_paragraph],
            ['280 E. Magnolia Blvd.'],
            ['Burbank, CA 91502'],
            ['310 - 840 - 0600'],
            ['www.2gdigitalpost.com']
        ]

        address_table = Table(address_table_data)

        P = Paragraph('<strong>Metadata Report</strong>', styleSheet["Heading2"])

        header_table = Table([[I, address_table, P]])

        title_table = get_title_table(metadata_report_sobject)

        section_one_header = Paragraph('Section 1 - Video Configuration', styleSheet['Heading3'])

        section_one_table_one = get_video_configuration_table_one(report_data)
        section_one_table_two = get_video_configuration_table_two(report_data)

        section_two_header = Paragraph('Section 2 - Audio Configuration', styleSheet['Heading3'])

        section_two_table_one = get_audio_configuration_table_one(report_data)
        section_two_table_two = get_audio_configuration_table_two(report_data)

        elements = []

        elements.append(header_table)
        elements.append(title_table)
        elements.append(section_one_header)
        elements.append(section_one_table_one)
        elements.append(section_one_table_two)
        elements.append(section_two_header)
        elements.append(section_two_table_one)
        elements.append(section_two_table_two)

        doc = SimpleDocTemplate(saved_file_path)

        doc.build(elements, canvasmaker=NumberedCanvas)
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:60,代码来源:export_metadata_report_command.py


示例7: get_image

 def get_image(self, path, width=3*inch, alignement='LEFT'):
     img = utils.ImageReader(path)
     iw, ih = img.getSize()
     aspect = ih / float(iw)
     final_im = Image(path, width=width, height=(width * aspect))
     final_im.hAlign = alignement
     return final_im
开发者ID:ProjetPC2,项目名称:SIMM2.0-DEV,代码行数:7,代码来源:ReqPiece.py


示例8: __init__

    def __init__(self, path):
        Image.__init__(self, path)
        import PIL

        w, h = PIL.Image.open(path).size
        self.maxw = w
        self.maxh = h
开发者ID:NoahLiot,项目名称:BloombergAPI,代码行数:7,代码来源:components.py


示例9: build_marco_logo_y_empresa

def build_marco_logo_y_empresa(dde):
    """
    dde es una lista con la ruta al logotipo de la empresa (o None) y una 
    serie de líneas de texto con los datos a mostrar de la empresa.
    Devuelve una tabla con los marcos transparentes con el logo y las 
    líneas.
    """
    if dde[0] != None:
        logo = Image(dde[0])
        logo.drawHeight = 2*cm * logo.drawHeight / logo.drawWidth
        logo.drawWidth = 2*cm
    else:
        logo = Paragraph("", estilos["Normal"])
    lineas_empresa = dde[1:]
    if len(lineas_empresa) <= 3: 
        empresa = Preformatted("\n".join(lineas_empresa), estilos["Normal"])
    else:
        texto_empresa = lineas_empresa[0] + "\n" 
            #+ ". ".join(lineas_empresa[1:])
        resto_lineas = lineas_empresa[1:]
        pivot = len(resto_lineas)/2
        r1, r2 = resto_lineas[:pivot], resto_lineas[pivot:]
        texto_empresa += ". ".join(r1) + "\n" + ". ".join(r2)
        empresa = Preformatted(texto_empresa, estilos["Normal"])
    datos = [[logo, empresa]]
    tabla = Table(datos, 
                  colWidths = (PAGE_WIDTH * 0.25, 
                               PAGE_WIDTH * 0.65)) 
    tabla.setStyle(TableStyle([
        ("ALIGN", (0, 0), (1, 0), "RIGHT"), 
        ("ALIGN", (1, 0), (-1, -1), "LEFT"), 
        ("VALIGN", (0, 0), (-1, -1), "CENTER"), 
        ]))
    return tabla
开发者ID:pacoqueen,项目名称:bbinn,代码行数:34,代码来源:albaran_porte.py


示例10: _create_pdf_all

def _create_pdf_all(cls, items):
	styles = _prepare_styles()
	style_header = styles['FieldHead']
	style_normal = styles['Normal']
	style_title = styles['ItemTitle']

	fields = cls.fields
	table_style = TableStyle([('GRID', (0, 0), (-1, -1), 0.25, colors.black)])

	for item in items:
		if cls.title_show:
			yield Paragraph(item.title, style_title)

		rows = []
		for field_name, field_type, dummy, dummy in fields:
			row = [Paragraph(objects.get_field_value_human(field_name),
					style_header)]
			if field_type == 'image':
				blob = item.get_blob(field_name)
				if blob:
					img = Image(StringIO(blob), lazy=2)
					img.drawWidth = img.drawWidth / 150. * inch
					img.drawHeight = img.drawHeight / 150. * inch
					row.append(img)
			else:
				row.append(Paragraph(objects.get_field_value_human(
					item.get_value(field_name)), style_normal))
			rows.append(row)
		yield Table(rows, [5 * cm, None], style=table_style)
		yield Spacer(0.5 * cm, 0.5 * cm)
开发者ID:KarolBedkowski,项目名称:alldb,代码行数:30,代码来源:pdf_support.py


示例11: build

    def build(self):
        doc = TagDocTemplate(self.out_file)
        doc.addPageTemplates([BackgroundTemplate(
            'qringly.pdf', name='background')])

        story = []
        style = styles['Normal']
        
        # FIXME: The tempfiles are handled in an ugly manner.
        tempfiles = []
        for sticker in self.stickers:
            try:
                handle, tmp = mkstemp('_qrtag.png')
                os.close(handle)
                img = sticker.build()
                img.save(tmp, 'png')
                scaled_size = INNER_WIDTH - 4 * PAD
                story.append(NextPageTemplate('background'))
                qr_img = PDFImage(tmp, width=scaled_size, height=scaled_size)
                qr_img.hAlign = 'CENTER'
                story.append(Spacer(INNER_WIDTH, 2 * PAD))
                story.append(qr_img)
                story.append(Paragraph(sticker.line, line_style))
                story.append(PageBreak())
            finally:
                tempfiles.append(tmp)

        doc.build(story)
        for tmp in tempfiles:
            os.remove(tmp)
开发者ID:imclab,项目名称:qrtag,代码行数:30,代码来源:qrtag.py


示例12: __headImage

 def __headImage(self, zone):
     if zone == self.EST:
         imagePath = common.rootPath+"evenement_est.jpg"
     else: #zone == self.SUD-EST
         imagePath = common.rootPath+"evenement_sud_est.jpg"
     evenement_Image = Image(imagePath, width=484 , height=102)
     evenement_Image.spaceAfter = 30
     self.elements.append(evenement_Image)
开发者ID:cazino,项目名称:Formation,代码行数:8,代码来源:base_evenement.py


示例13: _header_footer

    def _header_footer(self, canvas, doc):
        """ Renders a header and footer which will be inserted regardless of pdf method"""
        
        # Save the state of our canvas so we can draw on it
        canvas.saveState()
        stylesheet = getSampleStyleSheet()
 
        # Header
        logo = Image("http://www.fabco.la/fabco-seal-1.png", width=1.5*inch, height=1.5*inch)
        logo.hAlign = 'CENTER'
        
        stylesheet['BodyText'].fontSize = 10    
        stylesheet['BodyText'].leading = 14
        stylesheet['BodyText'].leftIndent = 5
        stylesheet['BodyText'].textColor = 'gray'
        
        FabcoAddress = "Fabco Art Services\n166 West Avenue 34\nLos Angeles CA 90031"
                                       
                                       
        project = get_object_or_404(Project, pk=self.pk)
        rightHeader = "Job #%s\nCompletion Date %s" % (project.project_id, project.due_date)
        
        # Build and format Left Header Table:
        leftHeaderData = [[FabcoAddress],
                            [project.client.first_name + ' ' + project.client.last_name+'\n'+project.client.address.street+'\n'+project.client.address.city + ' ' + project.client.address.zip_code], 
                            ]
        leftHeaderTable = Table(leftHeaderData)
        leftHeaderTable.setStyle(TableStyle([
                                            ('LEFTPADDING',(0,0),(0, 1),0),
                                            ('TOPPADDING',(0,1),(0, 1), 30),
                                            ('BOTTOMPADDING',(0,1),(0, 1), 0),                                            
                                            ]))

        # Build and format Header Table:
        headerData = [([leftHeaderTable, logo, rightHeader])]
        headerTable = Table(headerData, colWidths=doc.width/3)
        headerTable.setStyle(TableStyle([
            ('VALIGN', (0, 0), (-3, 0), 'MIDDLE'),
            ('VALIGN', (0, 0), (0, 0), 'TOP'),
            ('ALIGN',(1,0),(1,0),'CENTER'),
            ('ALIGN',(2,0),(2,0),'RIGHT'),
            ('LEFTPADDING',(0,0),(0,0),-1),
            ('RIGHTPADDING',(2,0),(2,0),-1),        
            ]))
        
        
        # find required space | I don't really understand this..    
        w, h = headerTable.wrap(doc.width, doc.height)
        # render to canvas | I also don't really understand this..
        headerTable.drawOn(canvas, doc.leftMargin, doc.height + doc.topMargin - doc.bottomMargin) 
 
        # Footer
        footer = Paragraph('Client Signature: _________________________', stylesheet['Normal'])
        w, h = footer.wrap(doc.width, doc.bottomMargin)
        footer.drawOn(canvas, doc.leftMargin, doc.bottomMargin)
 
        # Release the canvas
        canvas.restoreState()
开发者ID:ssbothwell,项目名称:fabco.la,代码行数:58,代码来源:printing.py


示例14: export_pdf

    def export_pdf(prequal_eval_sobject):
        parser = SafeConfigParser()
        config_path = os.path.abspath(os.path.dirname(__file__))
        parser.read(config_path + '/config.ini')

        file_name = prequal_eval_sobject.get('name') + '.pdf'
        save_location = parser.get('save', 'directory')

        saved_file_path = os.path.join(save_location, file_name)

        doc = SimpleDocTemplate(saved_file_path, pagesize=letter)

        elements = []

        styleSheet = getSampleStyleSheet()

        I = Image(os.path.dirname(os.path.realpath(__file__)) + '/2g_logo.png')
        I.drawHeight = 1.25 * inch * I.drawHeight / I.drawWidth
        I.drawWidth = 1.25 * inch

        top_address_paragraph = Paragraph('<strong>2G Digital Post, Inc.</strong>', styleSheet["BodyText"])

        address_table_data = [
            [top_address_paragraph],
            ['280 E. Magnolia Blvd.'],
            ['Burbank, CA 91502'],
            ['310 - 840 - 0600'],
            ['www.2gdigitalpost.com']
        ]

        address_table = Table(address_table_data)

        approved_rejected_status = prequal_eval_sobject.get('status')
        approved_rejected_table_data = [[Paragraph('Status: <strong>{0}</strong>'.format(approved_rejected_status),
                                                   styleSheet["BodyText"])]]

        approved_rejected_table = Table(approved_rejected_table_data)

        client_name = get_name_from_code(prequal_eval_sobject.get('client_code'), 'twog/client')

        # If a client name is not specified, just put 'Element Evaluation' at the top of the report in its place
        if not client_name:
            client_name = "Element Evaluation"

        P = Paragraph('<strong>{0}</strong>'.format(client_name), styleSheet["Heading2"])

        header_table = Table([[I, address_table, P, approved_rejected_table]])

        elements.append(header_table)

        general_comments_header = Paragraph('General Comments', styleSheet['Heading3'])
        general_comments = Paragraph(prequal_eval_sobject.get('general_comments'), styleSheet['BodyText'])

        top_table = get_top_table(prequal_eval_sobject)

        title_table = get_title_table(prequal_eval_sobject)

        prequal_eval_lines_table = get_prequal_eval_lines_table(prequal_eval_sobject)
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:58,代码来源:export_prequal_eval_command.py


示例15: chooseSig

def chooseSig(elements):
    msg = wx.MessageDialog(None, "Include signature?", "Message", wx.YES_NO | wx.ICON_QUESTION)
    if msg.ShowModal() == wx.ID_YES:
	logo = "/home/mb/Dropbox/Office/%sSignature.png" % settings.HOME_FOLDER
	im = Image(logo, 2*inch, 0.75*inch)
	im.hAlign = "LEFT"
	elements.append(im)
    else:
	elements.append(Spacer(1, 36))
开发者ID:barronmo,项目名称:gecko_emr,代码行数:9,代码来源:Printer.py


示例16: img

    def img(self, e):
        width = toLength(e.get('width'))
        height = toLength(e.get('height'))
        path = e.get('src')
        align = e.get('align', 'left').upper()

        img_obj = Image(self.get_from_url(path), width=width, height=height)
        img_obj.hAlign = align

        yield img_obj
开发者ID:mvpoland,项目名称:django-pdfgen,代码行数:10,代码来源:parser.py


示例17: insert_image

def insert_image(image, full_width=False, max_height=None):
    """Return image flowable, scaled to fit.

    For landscape images, 'fit' means page width.

    For portrait images, 'fit' means the height has to be the same as that of
    a landscape image.

    """

    width, height = image.getSize()
    if not width:
        return []
    if full_width:
        max_width = (21 - 2.5 - 2.5) * units.cm
    else:
        # Add a bit of padding, as otherwise you won't commonly get two photos
        # on the same page.
        max_width = (21 - 2.5 - 2.5 - 2) * units.cm
    if width >= height or full_width:
        # Landscape (or portrait where we want to use the full width/height).
        img_width = max_width
        img_height = max_width * height / width
        # Compensation for too-high images
        if not max_height:
            max_height = (29.7 - 4 - 3 - 2) * units.cm
        if img_height > max_height:
            factor = max_height / img_height
            img_width = img_width * factor
            img_height = img_height * factor
    else:
        # Portrait.
        img_height = max_width * width / height
        img_width = img_height * width / height

    url = image.absolute_url()
    try:
        image = Image(url,
                      width=img_width,
                      height=img_height)
    except ValueError:
        # Unreadable image: anon doesn't have permission.
        temp_name = tempfile.mktemp()
        temp_file = open(temp_name, 'w')
        temp_file.write(image.getImageAsFile().read())
        temp_file.close()
        image = Image(temp_name,
                      width=img_width,
                      height=img_height)
    return [Spacer(1, 0.1 * units.cm),
            image,
            ]
开发者ID:collective,项目名称:collective.realestatebroker,代码行数:52,代码来源:common.py


示例18: generateCertificate

def generateCertificate(user,event_name):
    try:
        userProfile = UserProfile.objects.using('mainsite').get(user = user)
    except:
        
        return None
    """
    if event.__class__.__name__!='GenericEvent':
        return None
    """
    # Create a buffer to store the contents of the PDF.
    # http://stackoverflow.com/questions/4378713/django-reportlab-pdf-generation-attached-to-an-email
    buffer = StringIO()
    
    CS = (3508, 2480)  # Certificate [Page] Size
    #CS = landscape(A4)

    # Create the PDF object, using the response object as its "file."

    pdf = canvas.Canvas(buffer, pagesize=CS)

    # Get the width and height of the page.

    (pageWidth, pageHeight) = CS
    
    y = pageHeight
    x = 0
    
    im = Image("/home/shaastra/hospi/certis/certback_final.jpg")
    im.hAlign = 'LEFT'
    
    paintImage(pdf, x, y, im)
    
    # Set font for Participant Name
    lineheight = PDFSetFont(pdf, 'Times-Bold', 80)
    xuser = (30.8 + (65.54/2))*cm
    yuser = 45.62*cm + lineheight
    name = constructName(user)
    pdf.drawString(xuser, yuser, '%s' % name)
    xevent = (24.3 + (65.54/2))*cm
    yevent = 37.62*cm + lineheight
    ename = event_name
    pdf.drawString(xevent, yevent, '%s' % ename)
    
    
    pdf.showPage()
    pdf.save()

    response = buffer.getvalue()
    buffer.close()

    return response
开发者ID:ShaastraWebops,项目名称:ERP14,代码行数:52,代码来源:certificates_2k14.py


示例19: report4

def report4(request):
    # Create the HttpResponse object with the appropriate PDF headers.
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=somefilename.pdf'
 
    doc = SimpleDocTemplate(response, pagesize=letter)
    # container for the 'Flowable' objects
    elements = []
 
    styleSheet = getSampleStyleSheet()
 
    I = Image('replogo.jpeg')
    I.drawHeight = 1.25*inch*I.drawHeight / I.drawWidth
    I.drawWidth = 1.25*inch
    P0 = Paragraph('''
                   <b>A pa<font color=red>r</font>a<i>graph</i></b>
                   <super><font color=yellow>1</font></super>''',
                   styleSheet["BodyText"])
    P = Paragraph('''
        <para align=center spaceb=3>The <b>ReportLab Left
        <font color=red>Logo</font></b>
        Image</para>''',
        styleSheet["BodyText"])
    data= [['A', 'B', 'C', P0, 'D'],
           ['00', '01', '02', [I,P], '04'],
           ['10', '11', '12', [P,I], '14'],
           ['20', '21', '22', '23', '24'],
           ['30', '31', '32', '33', '34']]
 
    t=Table(data,style=[('GRID',(1,1),(-2,-2),1,colors.green),
                        ('BOX',(0,0),(1,-1),2,colors.red),
                        ('LINEABOVE',(1,2),(-2,2),1,colors.blue),
                        ('LINEBEFORE',(2,1),(2,-2),1,colors.pink),
                        ('BACKGROUND', (0, 0), (0, 1), colors.pink),
                        ('BACKGROUND', (1, 1), (1, 2), colors.lavender),
                        ('BACKGROUND', (2, 2), (2, 3), colors.orange),
                        ('BOX',(0,0),(-1,-1),2,colors.black),
                        ('GRID',(0,0),(-1,-1),0.5,colors.black),
                        ('VALIGN',(3,0),(3,0),'BOTTOM'),
                        ('BACKGROUND',(3,0),(3,0),colors.limegreen),
                        ('BACKGROUND',(3,1),(3,1),colors.khaki),
                        ('ALIGN',(3,1),(3,1),'CENTER'),
                        ('BACKGROUND',(3,2),(3,2),colors.beige),
                        ('ALIGN',(3,2),(3,2),'LEFT'),
    ])
    t._argW[3]=1.5*inch
 
    elements.append(t)
    # write the document to disk
    doc.build(elements)
    
    return response
开发者ID:thmarkos,项目名称:nskDev,代码行数:52,代码来源:views.py


示例20: add_header

    def add_header(self):
        # aiddata logo
        logo = self.dir_base + "/templates/logo.png"

        im = Image(logo, 2.188 * inch, 0.5 * inch)
        im.hAlign = "LEFT"
        self.Story.append(im)

        self.Story.append(Spacer(1, 0.25 * inch))

        # title
        ptext = "<font size=20>AidData geo(query) Request Documentation</font>"
        self.Story.append(Paragraph(ptext, self.styles["Center"]))
开发者ID:itpir,项目名称:det-module,代码行数:13,代码来源:documentation_tool.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python platypus.Paragraph类代码示例发布时间:2022-05-26
下一篇:
Python platypus.Frame类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap