本文整理汇总了Python中reportlab.platypus.flowables.Flowable类的典型用法代码示例。如果您正苦于以下问题:Python Flowable类的具体用法?Python Flowable怎么用?Python Flowable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flowable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, master, margin=10):
Flowable.__init__(self)
self.master = master
self.margin = 10
if master.medical_technologist or master.pathologist:
self.has_data = True
else:
self.has_data = False
示例2: __init__
def __init__(self, maxWidth, content=[], style=None, mode=None, scale=None):
self.maxWidth = maxWidth
self.content = content
self.style = style
self.mode = mode
self.pad = None
self.scale = scale
Flowable.__init__(self)
示例3: __init__
def __init__(self, component=None, bounds=None,
fixed_scale=None, hAlign='CENTER'):
self.fixed_scale = fixed_scale
self.component = component
if bounds is None:
bounds = (500, 500)
self.component.outer_bounds = bounds
self.component.do_layout(force=True)
Flowable.__init__(self)
if hAlign:
self.hAlign = hAlign
示例4: __init__
def __init__(self, filename, width=None, height=None, kind='bound',
mask=None, lazy=True, srcinfo=None):
Flowable.__init__(self)
self._kind = kind
page = PdfReader(filename, decompress=False).pages[0]
self.xobj = pagexobj(page)
self.imageWidth, self.imageHeight = imageWidth, imageHeight = self.xobj.w, self.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
示例5: __init__
def __init__(self, width, height, number=None, font=None, size=None, align="left"):
Flowable.__init__(self)
self.width = width
self.height = height
self.number = number
if not font:
font = "Helvetica"
if not size:
size = 8
self.size = size
self.font = font
self.align = align
示例6: __init__
def __init__(self,string,font_name,font_size,color=HexColor('#FFFFFF'),color_space = 'RGB',x0=0,y0=0,border=False):
Flowable.__init__(self)
self.stroke_width = 0.1
self.border = border
self.border_width = 2
self.border_color = HexColor('#FFFFFF')
self.interline = 0.5*mm
self.text = string
#print self.text
self.text_font = font_name
self.text_font_size = font_size
self.color = color
self.content_width = utils.text.size.width(self.text,self.text_font,self.text_font_size)
self.content_height = len(self.text.split('<br/>'))*self.text_font_size + (len(self.text.split('<br/>')) -1)*self.interline
示例7: __init__
def __init__(self, text, style, debug=False, splitted=False, **kwDict):
Flowable.__init__(self)
self.text = text
self.text.calc()
self.style = style
self.text.style = style
self.debug = debug
self.splitted = splitted
# More attributes
for k, v in six.iteritems(kwDict):
setattr(self, k, v)
# set later...
self.splitIndex = None
示例8: __init__
def __init__(self, node, styles, value, encoding):
Flowable.__init__(self)
self.node = node
self.styles = styles
self.value = value
self.encoding = encoding
self.xpos = utils.unit_get(node.getAttribute('x'))
self.ypos = utils.unit_get(node.getAttribute('y'))
self.width = utils.unit_get(node.getAttribute('width'))
self.height = utils.unit_get(node.getAttribute('height'))
self.code_name = node.getAttribute('code')
self.codes = getCodes()
from trml2pdf.parser import ParserError
try:
self.codes[self.code_name]
except KeyError, msg:
raise ParserError("Unknown barcode name '%s'." % self.code_name)
示例9: __init__
def __init__(self, formName, orientation=None,iptrans=None, callback=None,
pdf_data=None, user_data=None,
pdfBoxType=None,
autoCrop=None,
pageSize=None,
pageSizeHandler=None,
):
Flowable.__init__(self)
self.formName = formName
self._orientation = orientation
self._iptrans = iptrans
self._pdfBoxType = pdfBoxType
self._autoCrop = autoCrop
self._pageSize = pageSize
self._pageSizeHandler = pageSizeHandler
self._pdf_data = pdf_data
if callback:
self.callback = lambda key,canv: callback(key,canv,self,pdf_data,user_data)
else:
self.callback = lambda key,canv: None
示例10: __init__
def __init__(self, barCodeSymbol):
Flowable.__init__(self)
assert hasattr(barCodeSymbol,'font')
"name of font to use for printing human-readable text"
assert hasattr(barCodeSymbol,'bits')
"""string of 0,1 and L characters. each character stands for one
"bit" or "module". 0 means white, 1 means black, L means long
black"""
assert hasattr(barCodeSymbol,'moduleHeight')
"module height in points"
assert hasattr(barCodeSymbol,'patternWidth')
"width in inch"
self.lightMargin = 9 * barCodeSymbol.moduleWidth * inch
self.barCodeSymbol = barCodeSymbol
self.width = self.barCodeSymbol.patternWidth * inch \
+ self.lightMargin * 2
self.height = self.barCodeSymbol.moduleHeight * inch
示例11: __init__
def __init__(self, story, height=None, width=None, pos_x=None, pos_y=None,
frame_attrs=freeze({}), attributes=freeze({}), pto_trailer=None,
pto_header=None):
Flowable.__init__(self)
# get on story
self.div_story = story
# set frame style
self.frame_attrs = {'leftPadding': 0, 'bottomPadding': 0,
'rightPadding': 0, 'topPadding': 0,
'showBoundary': 0}
# PTO initialisation
self.pto_trailer = pto_trailer
self.pto_header = pto_header
if frame_attrs is not None:
self.frame_attrs.update(frame_attrs)
for margin in ('topMargin', 'bottomMargin', 'leftMargin',
'rightMargin'):
if margin in self.frame_attrs:
del self.frame_attrs[margin]
border = self.frame_attrs['showBoundary']
if isinstance(border, ShowBoundaryValue):
border = border.width
if border:
for padding_attr in FRAME_PADDINGS_KEYS:
self.frame_attrs[padding_attr] += border
self.frame_width = width
# Overflow
# TODO to improve
self.keep_in_frame = None
style = attribute_style_to_dict(attributes.get((None, 'style'), ''))
self.overflow = style.get('overflow-y', None)
if self.overflow == 'hidden':
self.overflow = 'truncate'
else:
self.overflow = None
示例12: __init__
def __init__(self, library, width, height, data, scale=1, type='datamatrix', align='left'):
'''
Creates a Barcode Flowable
* width and height define the size in ReportLab points (for example 2*cm x 2*cm)
* data will be encoded as the barcode
* scale allows you to resize the barcode (default 1)
* type is the type of the barcode (default 'datamatrix').
Other types can be found in media/common/pdf_img/barcode.ps
'''
Flowable.__init__(self)
self.width = width
self.height = height
self.scale = scale
self.data = data
self.resolution_factor = 8
self.type = type
self.hAlign = 'CENTER'
self.library = library
self.align = align
示例13: __init__
def __init__(self,price_rub,price_kop,items=1,scale=1,x0=0,y0=0):
Flowable.__init__(self)
self.scale = scale
self.price_rub = price_rub
self.price_kop = price_kop
self.items = str(items) + '.шт'
self.rub_font = 'HelveticaNeue-BoldCr'
self.rub_font_size = 28*scale
self.rub_width = utils.text.size.width(self.price_rub,self.rub_font,self.rub_font_size)
self.kop_font = 'HelveticaNeue-BoldCr'
self.kop_font_size = 15*scale
self.kop_width = utils.text.size.width(self.price_kop,self.kop_font,self.kop_font_size)
self.splitter_font = 'HelveticaNeue-BoldCr'
self.splitter_font_size = 28*scale
self.y_splitter = 4
self.items_font = 'HelveticaNeue_LT_CYR_57_Cond'
self.items_font_size = 5*scale
self.items_width = utils.text.size.width(self.items,self.items_font,self.items_font_size)
self.y_items = 4
self.x0 = x0
self.y0 = y0
self.y0_kop = 10
self.stroke_width = 2
self.scale = scale
self.content_width = self.rub_width + max([self.kop_width,self.items_width]) + 5*mm
self.content_height = self.rub_font_size = 28*scale + 2*mm
self.body_color = HexColor('#CE1527')
self.body_color = HexColor('#204A87')
self.line_color = HexColor('#FFFFFF')
示例14: __init__
def __init__(self, text, style):
Flowable.__init__(self)
self.text = text
self.height = 4 * cm
self.style = style
示例15: __init__
def __init__(self,width,height,color):
Flowable.__init__(self)
self.width = width*mm
self.height = height*mm
self.color = HexColor(color)