本文整理匯總了Python中reportlab.platypus.flowables.Image.wrapOn方法的典型用法代碼示例。如果您正苦於以下問題:Python Image.wrapOn方法的具體用法?Python Image.wrapOn怎麽用?Python Image.wrapOn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類reportlab.platypus.flowables.Image
的用法示例。
在下文中一共展示了Image.wrapOn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: draw
# 需要導入模塊: from reportlab.platypus.flowables import Image [as 別名]
# 或者: from reportlab.platypus.flowables.Image import wrapOn [as 別名]
def draw(self):
canvas = self.canv
img = Image(self.barcode)
width, height = img.wrapOn(canvas, 0, 0)
width = width * 72. / 300
height = height * 72. / 300
canvas.drawImage(
self.barcode,
self.x * mm,
(self.y * mm * -1) - height,
width,
height,
)
示例2: _draw_image
# 需要導入模塊: from reportlab.platypus.flowables import Image [as 別名]
# 或者: from reportlab.platypus.flowables.Image import wrapOn [as 別名]
def _draw_image(self, img_path, width=None, height=None, **kwargs):
"""Draw an image"""
canvas = self.canv
img = Image(img_path)
_width, _height = img.wrapOn(canvas, 0, 0)
_width = _width * 72. / 300
_height = _height * 72. / 300
if width is not None:
_width = width
if height is not None:
_height = height
canvas.drawImage(
img_path,
self.cursor.x * self.unit,
self.cursor.y * self.unit - _height,
_width,
_height,
)