本文整理汇总了Python中reportlab.platypus.SimpleDocTemplate.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleDocTemplate.__init__方法的具体用法?Python SimpleDocTemplate.__init__怎么用?Python SimpleDocTemplate.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus.SimpleDocTemplate
的用法示例。
在下文中一共展示了SimpleDocTemplate.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, invoice_path, pdf_info=None):
if not pdf_info:
pdf_info = self.default_pdf_info
SimpleDocTemplate.__init__(
self,
invoice_path,
pagesize=letter,
rightMargin=inch,
leftMargin=inch,
topMargin=inch,
bottomMargin=inch,
**pdf_info.__dict__
)
self._defined_styles = getSampleStyleSheet()
self._defined_styles.add(
ParagraphStyle('RightHeading1', parent=self._defined_styles.get('Heading1'), alignment=TA_RIGHT)
)
self._defined_styles.add(
ParagraphStyle('TableParagraph', parent=self._defined_styles.get('Normal'), alignment=TA_CENTER)
)
self.invoice_info = None
self.service_provider_info = None
self.client_info = None
self.is_paid = False
self._items = []
self._item_tax_rate = None
self._transactions = []
self._story = []
self._bottom_tip = None
self._bottom_tip_align = None
示例2: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, filename, title_left, title_right, portrait=True):
if portrait is True:
page_size = A4
column_width = 8*cm
else:
page_size = landscape(A4)
column_width = 13*cm
SimpleDocTemplate.__init__(self, filename, pagesize=page_size,
topMargin=0*cm,
leftMargin=2 * cm,
rightMargin=2 * cm,
bottomMargin=0.5 * cm,
)
self.fileName = filename
im1 = Image(settings.MEDIA_ROOT + 'logo_EPC.png', width=170, height=80, hAlign=TA_LEFT)
data = list()
data.append([im1, ''])
data.append([Spacer(0, 0.5*cm)])
data.append([title_left, title_right])
t = Table(data, colWidths=[column_width]*2, hAlign=TA_LEFT)
t.setStyle(
TableStyle(
[
('SIZE', (0, 0), (-1, -1), 9),
('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'),
('ALIGN', (0, 0), (0, 0), 'LEFT'),
('ALIGN', (1, 0), (-1, -1), 'RIGHT'),
('LINEABOVE', (0, 0), (-1, -1), 0.5, colors.black),
('LINEBELOW', (0, -1), (-1, -1), 0.5, colors.black),
]
)
)
self.flowable.append(t)
示例3: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, toc, indexedFlowable, filename, firstPageNumber = 1, **kw ):
"""toc is the TableOfContents object
indexedFlowale is a dictionnary with flowables as key and a dictionnary as value.
the sub-dictionnary have two key:
text: the text which will br print in the table
level: the level of the entry( modifying the indentation and the police
"""
self._toc = toc
self._indexedFlowable = indexedFlowable
self._filename = filename
self._part = ""
self._firstPageNumber = firstPageNumber
SimpleDocTemplate.__init__(self, filename, **kw)
setTTFonts()
示例4: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, filename):
# Sigh. SimpleDocTemplate is an old-style class
SimpleDocTemplate.__init__(self, filename,
pagesize=pagesizes.letter)
self.stylesheet = StyleSheet()
self.header_lines = []
self._this_section = Section('Untitled')
# Start with a Spacer for the header on the first page
self.story = [Spacer(1, 1.5 * units.inch)]
self.leftMargin = 0.5 * units.inch
self.rightMargin = self.leftMargin
self.topMargin = 0.5 * units.inch
self.bottomMargin = 0.75 * units.inch
# Record the width and height now, because in the build stage
# width and height are set to the area inside the margins
(self.page_w, self.page_h) = pagesizes.letter
示例5: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, filename, firs, dateStr, notams, mapinfo,
mapdata, copyright_holder, **kw):
SimpleDocTemplate.__init__(self, filename, **kw)
self.lat0 = mapinfo[0]
self.lon0 = mapinfo[1]
self.notams = notams
self.dateStr = dateStr
self.firs = firs
self.bottomOffset = 5*mm
self.map_data = mapdata
self.copyright_holder = copyright_holder
self.mapwidth = self.pagesize[0]-self.rightMargin-self.leftMargin
self.mapheight = self.pagesize[1]-self.bottomMargin-self.topMargin-\
self.bottomOffset-20*mm
self.scale =\
self.mapwidth/(mapinfo[2]*math.cos(math.radians(self.lat0)))
示例6: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, *args, **kwargs):
SimpleDocTemplate.__init__(self, *args, **kwargs)
self._n_pages = 0
示例7: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, filename, **kw):
SimpleDocTemplate.__init__(self, filename, **kw)
示例8: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, filename, **kwargs):
"Overide to provide baruwa defaults"
SimpleDocTemplate.__init__(self, filename, **kwargs)
# self.encrypt = StandardEncryption('', canModify=0)
self.pagesize = A4
self.author = 'Baruwa 2.0'
示例9: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, fileName,**kw):
SimpleDocTemplate.__init__(self,fileName,**kw)
self.leftMargin, self.rightMargin = 0.5*inch,0.5*inch
self.topMargin,self.bottomMargin = 0.5*inch,0.5*inch
示例10: __init__
# 需要导入模块: from reportlab.platypus import SimpleDocTemplate [as 别名]
# 或者: from reportlab.platypus.SimpleDocTemplate import __init__ [as 别名]
def __init__(self, *args, **kw):
SimpleDocTemplate.__init__ (self, *args, **kw)