本文整理匯總了Python中reportlab.platypus.Flowable類的典型用法代碼示例。如果您正苦於以下問題:Python Flowable類的具體用法?Python Flowable怎麽用?Python Flowable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Flowable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, width, height, caption="",
captionFont=_baseFontNameI, captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=None,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
captionAlign='centre',
captionPosition='bottom',
hAlign='CENTER',
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap or 0.5*captionSize
self.captionAlign = captionAlign
self.captionPosition = captionPosition
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
self.hAlign=hAlign
self._getCaptionPara() #Larry Meyn's fix - otherwise they all get the number of the last chapter.
示例2: __init__
def __init__(self, measure_unit, document):
Flowable.__init__(self)
self.unit = measure_unit
self.cursor = Cursor()
self._elements = []
self.canv = document.canv
self._frame = document.pageTemplate.frames[0]
示例3: __init__
def __init__(self, width, height, images, preserve_aspect_ratio=True):
""" Initialize the 'TriPlanar' class.
If a None image is passed, an empty box will be displayed.
Parameters
----------
width: float (mandatory)
the element width.
heights: float (mandatory)
the element height.
images: 4-uplet or 1-uplet (mandatory)
the path to the images to be displayed. If a 4-uplet is specified
the display order is (image_upper_left, image_upper_right,
image_bottom_left, image_bottom_right)
preserve_aspect_ratio: bool (optional, default True)
if True preserve the image aspect ratios.
"""
Flowable.__init__(self)
self.width = width
self.height = height
self.display_mode = "multi"
if len(images) == 1:
self.display_mode = "single"
self.images = images
self.preserve_aspect_ratio = preserve_aspect_ratio
self.missing_file = os.path.join(os.path.dirname(__file__),
"resources", "missing.png")
示例4: __init__
def __init__(self,
resource,
item,
labels=None,
common=None,
backside=False,
multiple=False,
):
"""
Constructor
@param resource: the resource
@param item: the data item
@param labels: the field labels
@param common: common data for all cards
@param backside: this instance should render a card backside
@param multiple: there are multiple cards per page
"""
Flowable.__init__(self)
self.width, self.height = self.cardsize
self.resource = resource
self.item = item
self.labels = labels if labels is not None else {}
self.common = common if common is not None else {}
self.backside = backside
self.multiple = multiple
示例5: __init__
def __init__(self, width, height, caption="",
captionFont="Times-Italic", captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=1,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
示例6: __init__
def __init__(self, svg, width=None, height=None, kind='direct'):
# svg is either a text buffer with svg or a xml node object.
Flowable.__init__(self)
self._kind = kind
s = svglib.SvgRenderer()
if isinstance(svg, (str, unicode)):
doc = xml.dom.minidom.parseString(svg)
svg = doc.documentElement
s.render(svg)
self.doc = s.finish()
#self.doc = svglib.svg2rlg(filename)
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.doc.getBounds()
self._w, self._h = x2, y2
if not self.imageWidth:
self.imageWidth = self._w
if not self.imageHeight:
self.imageHeight = self._h
self.__ratio = float(self.imageWidth)/self.imageHeight
if kind in ['direct','absolute']:
self.drawWidth = width or self.imageWidth
self.drawHeight = height or self.imageHeight
elif kind in ['bound','proportional']:
factor = min(float(width)/self.imageWidth,float(height)/self.imageHeight)
self.drawWidth = self.imageWidth*factor
self.drawHeight = self.imageHeight*factor
示例7: __init__
def __init__(self, width, height, caption="",
captionFont="Times-Italic", captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=1,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
self._getCaptionPara() #Larry Meyn's fix - otherwise they all get the number of the last chapter.
示例8: __init__
def __init__(self, filename, width=None, height=None, kind='direct',
mask=None, lazy=True, srcinfo=None):
Flowable.__init__(self)
ext = os.path.splitext(filename)[-1]
self._kind = kind
# Prefer svg2rlg for SVG, as it works better
if LazyImports.svg2rlg:
self._mode = 'svg2rlg'
self.doc = LazyImports.svg2rlg.svg2rlg(filename)
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.doc.getBounds()
# Actually, svg2rlg's getBounds seems broken.
self._w, self._h = x2, y2
if not self.imageWidth:
self.imageWidth = self._w
if not self.imageHeight:
self.imageHeight = self._h
else:
self._mode = None
log.error("SVG support not enabled,"
" please install svg2rlg.")
self.__ratio = float(self.imageWidth)/self.imageHeight
if kind in ['direct','absolute']:
self.drawWidth = width or self.imageWidth
self.drawHeight = height or self.imageHeight
elif kind in ['bound','proportional']:
factor = min(float(width)/self.imageWidth,float(height)/self.imageHeight)
self.drawWidth = self.imageWidth*factor
self.drawHeight = self.imageHeight*factor
示例9: __init__
def __init__(self, filename, width=None, height=None, kind='direct',
mask=None, lazy=True, srcinfo=None):
Flowable.__init__(self)
self._kind = kind
self._mode = 'svg2rlg'
self.doc = svg2rlg(filename)
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.doc.getBounds()
# Actually, svg2rlg's getBounds seems broken.
self._w, self._h = x2, y2
if not self.imageWidth:
self.imageWidth = self._w
if not self.imageHeight:
self.imageHeight = self._h
self.__ratio = float(self.imageWidth) / self.imageHeight
if kind in ['direct', 'absolute']:
self.drawWidth = width or self.imageWidth
self.drawHeight = height or self.imageHeight
elif kind in ['bound', 'proportional']:
factor = min(
float(width) / self.imageWidth,
float(height) / self.imageHeight
)
self.drawWidth = self.imageWidth * factor
self.drawHeight = self.imageHeight * factor
示例10: __init__
def __init__(self, texto="", x=0, y=0, width=200, height=10):
Flowable.__init__(self)
self.x = x
self.y = y
self.width = width
self.height = height
self.texto = texto
self.styles = getSampleStyleSheet()
示例11: __init__
def __init__(self, fname, width, height):
Flowable.__init__(self)
self.fname = fname
self.width = width
self.height = height
self.x = 0
self.y = 0
self.page = 0
示例12: __init__
def __init__(self, x=0, y=-15, width=100, height=15, text=""):
Flowable.__init__(self)
self.x = x
self.y = y
self.width = width
self.height = height
self.text = text
self.styles = getSampleStyleSheet()
示例13: __init__
def __init__(self, doctor):
Flowable.__init__(self)
self.user = doctor.refer_userprofile.user
self.adr = doctor.address
self.x = 0
self.y = 25
self.width = 250
self.height = 15
self.styles = getSampleStyleSheet()
示例14: __init__
def __init__(self, fator=None, style=None, imagem=None, x=0, y=0, width=defaultPageSize[0] - (2 * cm), height=55):
Flowable.__init__(self)
self.x = x
self.y = y
self.width = width
self.height = height
self.fator = fator
self.style = style
self.imagem = imagem
示例15: __init__
def __init__(self, x=0, y=-15, width=40, height=15, text_label="", text_box=""):
Flowable.__init__(self)
self.x = x
self.y = y
self.width = width
self.height = height
self.text_box = text_box
self.text_label = text_label
self.styles = getSampleStyleSheet()
self.styles.add(ParagraphStyle(name='HeadText', fontName='OpenSans-Regular', fontSize=10))