本文整理汇总了Python中reportlab.platypus.Flowable类的典型用法代码示例。如果您正苦于以下问题:Python Flowable类的具体用法?Python Flowable怎么用?Python Flowable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flowable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.
开发者ID:AlonsoAyelen,项目名称:Voluntariado_veterinaria,代码行数:32,代码来源:figures.py
示例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]
开发者ID:affinitic,项目名称:affinitic.pdf,代码行数:7,代码来源:flowable.py
示例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")
开发者ID:neurospin,项目名称:pyconnectomist,代码行数:28,代码来源:pdftools.py
示例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
开发者ID:flavour,项目名称:aidiq,代码行数:31,代码来源:card.py
示例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
开发者ID:jwheare,项目名称:digest,代码行数:25,代码来源:figures.py
示例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
开发者ID:aytsai,项目名称:ricebowl,代码行数:27,代码来源:svgimage.py
示例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.
开发者ID:AceZOfZSpades,项目名称:RankPanda,代码行数:27,代码来源:figures.py
示例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
开发者ID:EronHennessey,项目名称:rst2pdf,代码行数:30,代码来源:svgimage.py
示例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
开发者ID:aquavitae,项目名称:rst2pdf-py3-dev,代码行数:26,代码来源:svgimage.py
示例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()
开发者ID:flaviomicheletti,项目名称:flask-collection,代码行数:8,代码来源:passo_040.py
示例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
开发者ID:dolvany,项目名称:dtrace-stap-book,代码行数:8,代码来源:pdf.py
示例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()
开发者ID:rsheil,项目名称:dnpworkup,代码行数:8,代码来源:dnp_rs.py
示例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()
开发者ID:Foxugly,项目名称:medagenda,代码行数:9,代码来源:invoice.py
示例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
开发者ID:flaviomicheletti,项目名称:flask-collection,代码行数:9,代码来源:laudo_007.py
示例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))
开发者ID:mimischi,项目名称:django-clock,代码行数:10,代码来源:printing.py
示例16: __init__
def __init__(self, s, label=None, fontsize=12, color='black'):
self.s = s
self.label = label
self.fontsize = fontsize
self.color = color
if HAS_MATPLOTLIB:
self.parser = mathtext.MathTextParser("Pdf")
else:
log.error('Math support not available, some parts of this ' +
'document will be rendered incorrectly. Install ' +
'matplotlib.')
Flowable.__init__(self)
self.hAlign = 'CENTER'
开发者ID:aquavitae,项目名称:rst2pdf-py3-dev,代码行数:13,代码来源:math_flowable.py
示例17: __init__
def __init__(self, filename, width=None, height=None, kind='direct',
mask=None, lazy=True, srcinfo=None):
Flowable.__init__(self)
self._kind = kind
self.xobj = xobj = self.load_xobj(srcinfo)
self.imageWidth, self.imageHeight = imageWidth, imageHeight = xobj.w, xobj.h
width = width or imageWidth
height = height or imageHeight
if kind in ['bound','proportional']:
factor = min(float(width)/imageWidth,float(height)/imageHeight)
width = factor * imageWidth
height = factor * imageHeight
self.drawWidth = width
self.drawHeight = height
开发者ID:123667,项目名称:deviation-manual,代码行数:14,代码来源:vectorpdf_r2p.py
示例18: __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 svglib for SVG, as it works better
if ext in ('.svg', '.svgz') and LazyImports.svglib:
self._mode = 'svglib'
self.doc = LazyImports.svglib.svg2rlg(filename)
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.doc.getBounds()
# Actually, svglib'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
# Use uniconvertor for the rest
elif LazyImports.uniconvertor:
load, plugins, self.uniconvertor_save = LazyImports.uniconvertor
self._mode = 'uniconvertor'
self.doc = load.load_drawing(filename.encode('utf-8'))
self.saver = plugins.find_export_plugin(
plugins.guess_export_plugin('.pdf'))
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.doc.BoundingRect()
# The abs is to compensate for what appears to be
# a bug in uniconvertor. At least doing it this way
# I get the same values as in inkscape.
# This fixes Issue 236
self._w, self._h = abs(x2)-abs(x1), abs(y2)-abs(y1)
if not self.imageWidth:
self.imageWidth = self._w
if not self.imageHeight:
self.imageHeight = self._h
else:
self._mode = None
log.error("Vector image support not enabled,"
" please install svglib and/or uniconvertor.")
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
开发者ID:ddd332,项目名称:presto,代码行数:50,代码来源:svgimage.py
示例19: __init__
def __init__(self, filename, width=None, height=None, kind='direct',
mask=None, lazy=True, srcinfo=None):
Flowable.__init__(self)
self._kind = kind
self.xobj = self.load_xobj(srcinfo)
self.imageWidth = width
self.imageHeight = height
x1, y1, x2, y2 = self.xobj.BBox
self._w, self._h = x2 - x1, y2 - y1
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
开发者ID:ddd332,项目名称:presto,代码行数:22,代码来源:__init__.py
示例20: __init__
def __init__(self, barcode, x, y):
Flowable.__init__(self)
self.barcode = barcode
self.x = x
self.y = y
开发者ID:IMIO,项目名称:imio.helpers,代码行数:5,代码来源:pdf.py
注:本文中的reportlab.platypus.Flowable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论