本文整理匯總了Python中reportlab.platypus.flowables.Image.drawHeight方法的典型用法代碼示例。如果您正苦於以下問題:Python Image.drawHeight方法的具體用法?Python Image.drawHeight怎麽用?Python Image.drawHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類reportlab.platypus.flowables.Image
的用法示例。
在下文中一共展示了Image.drawHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: old_tables_test
# 需要導入模塊: from reportlab.platypus.flowables import Image [as 別名]
# 或者: from reportlab.platypus.flowables.Image import drawHeight [as 別名]
#.........這裏部分代碼省略.........
('BACKGROUND', (0, 0), (0, 1), colors.pink),
('SPAN',(0,0),(0,1)),
('BACKGROUND',(-2,1),(-1,1),colors.palegreen),
('SPAN',(-2,1),(-1,1)),
('BACKGROUND',(-2,3),(-1,3),colors.yellow),
('SPAN',(-2,3),(-1,3)),
('BACKGROUND', (2, 3), (2, 4), colors.orange),
('SPAN',(2,3),(2,4)),
]
t=Table(data,style=sty,repeatRows=2)
lst.append(Paragraph("Illustrating splits with spans and repeatRows: nosplit", styleSheet['BodyText']))
lst.append(t)
lst.append(Spacer(0,6))
if 1:
lst.append(Paragraph("Illustrating splits with spans and repeatRows: split(4in,30)", styleSheet['BodyText']))
for s in t.split(4*inch,30):
lst.append(s)
lst.append(Spacer(0,6))
lst.append(Spacer(0,6))
lst.append(Paragraph("Illustrating splits with spans and repeatRows: split(4in,36)", styleSheet['BodyText']))
for s in t.split(4*inch,36):
lst.append(s)
lst.append(Spacer(0,6))
lst.append(Paragraph("Illustrating splits with spans and repeatRows: split(4in,56)", styleSheet['BodyText']))
lst.append(Spacer(0,6))
for s in t.split(4*inch,56):
lst.append(s)
lst.append(Spacer(0,6))
lst.append(PageBreak())
from reportlab.lib.testutils import testsFolder
I = Image(os.path.join(os.path.dirname(testsFolder),'src','tools','pythonpoint','demos','leftlogo.gif'))
I.drawHeight = 1.25*inch*I.drawHeight / I.drawWidth
I.drawWidth = 1.25*inch
#I.drawWidth = 9.25*inch #uncomment to see better messaging
P = Paragraph("<para align=center spaceb=3>The <b>ReportLab Left <font color=red>Logo</font></b> Image</para>", styleSheet["BodyText"])
B = TableBarChart()
BP = Paragraph("<para align=center spaceb=3>A bar chart in a cell.</para>", styleSheet["BodyText"])
data= [['A', 'B', 'C', Paragraph("<b>A pa<font color=red>r</font>a<i>graph</i></b><super><font color=yellow>1</font></super>",styleSheet["BodyText"]), 'D'],
['00', '01', '02', [I,P], '04'],
['10', '11', '12', [I,P], '14'],
['20', '21', '22', '23', '24'],
['30', '31', '32', '33', '34'],
['40', '41', '42', [B,BP], '44']]
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
lst.append(t)
示例2: insertImage
# 需要導入模塊: from reportlab.platypus.flowables import Image [as 別名]
# 或者: from reportlab.platypus.flowables.Image import drawHeight [as 別名]
def insertImage(self, imagePath, height, width):
img = Image(imagePath)
img.drawHeight = height
img.drawWidth = width
self.Story.append(img)