本文整理汇总了Python中reportlab.platypus.doctemplate.BaseDocTemplate类的典型用法代码示例。如果您正苦于以下问题:Python BaseDocTemplate类的具体用法?Python BaseDocTemplate怎么用?Python BaseDocTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseDocTemplate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, filename, **kw):
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate('normal', [Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')])
self.addPageTemplates(template)
def afterFlowable(self, flowable):
"Registers TOC entries."
开发者ID:PREM1980,项目名称:ecomstore,代码行数:7,代码来源:testpdf.py
示例2: __init__
def __init__(self, filename, **kw):
m = 2 * cm
from reportlab.lib import pagesizes
PAGESIZE = pagesizes.landscape(pagesizes.A4)
cw, ch = (PAGESIZE[0] - 2 * m) / 2.0, (PAGESIZE[1] - 2 * m)
ch -= 14 * cm
f1 = Frame(
m,
m + 0.5 * cm,
cw - 0.75 * cm,
ch - 1 * cm,
id="F1",
leftPadding=0,
topPadding=0,
rightPadding=0,
bottomPadding=0,
showBoundary=True,
)
f2 = Frame(
cw + 2.7 * cm,
m + 0.5 * cm,
cw - 0.75 * cm,
ch - 1 * cm,
id="F2",
leftPadding=0,
topPadding=0,
rightPadding=0,
bottomPadding=0,
showBoundary=True,
)
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate("template", [f1, f2])
self.addPageTemplates(template)
开发者ID:TribunoDev,项目名称:pm,代码行数:34,代码来源:test_platypus_paragraphs.py
示例3: __init__
def __init__(self, filename, context, **kw):
BaseDocTemplate.__init__(self, filename, **kw)
self.toc_index = 0
self.main_frame_attr = {'x1': self.leftMargin,
'y1': self.bottomMargin,
'width': self.width,
'height': self.height,
'id':'normal',
'showBoundary': self.showBoundary}
# We keep the main frame reference to resize it during the build
self.main_frame = Frame(**self.main_frame_attr)
self.main_frame_change = False
template_attrs = {'id': 'now', 'frames': [self.main_frame],
'pagesize': kw['pagesize']}
page_template = PageTemplate(**template_attrs)
self.platypus_header_calculate = False
self.platypus_header_height = None
self.platypus_footer = None
self.context = context
self.addPageTemplates([page_template])
self.toc_high_level = self.context.toc_high_level
self.frame_attr = {'leftPadding': 0, 'bottomPadding': 6,
'rightPadding': 0, 'topPadding': 6,
'showBoundary': 0}
self.context = context
# calculate width available
self.width_available = self.width
self.width_available -= self.frame_attr['leftPadding']
self.width_available -= self.frame_attr['rightPadding']
开发者ID:Nabellaleen,项目名称:itools,代码行数:31,代码来源:doctemplate.py
示例4: __init__
def __init__(self, filename, **kw):
self.allowSplitting = 0
self.pagesize = kw.get('pagesize', landscape(A5))
kw['pagesize'] = self.pagesize
BaseDocTemplate.__init__(self, filename, **kw)
w, h = self.pagesize
# self.actualWidth, self.actualHeight = landscape(A5)
self.topMargin = 2.85 * cm
self.leftMargin = 0.15 * cm
self.bottomMargin = 0.15 * cm
fh = h - self.topMargin - self.bottomMargin
fw = w - (2 * self.leftMargin)
frame = Frame(self.leftMargin, self.bottomMargin,
fw, fh,
id='ContentFrame',
showBoundary=False)
template = PageTemplate('normal', frames=[frame, ],
pagesize=self.pagesize)
self.loadFonts()
self.addPageTemplates(template)
开发者ID:HCCB,项目名称:janus,代码行数:27,代码来源:reports.py
示例5: build
def build(self, flowables, onFirstPage=_doNothing, onLaterPages=_doNothing, canvasmaker=canvas.Canvas):
"""build the document using the flowables. Annotate the first page using the onFirstPage
function and later pages using the onLaterPages function. The onXXX pages should follow
the signature
def myOnFirstPage(canvas, document):
# do annotations and modify the document
...
The functions can do things like draw logos, page numbers,
footers, etcetera. They can use external variables to vary
the look (for example providing page numbering or section names).
"""
self._calc() # in case we changed margins sizes etc
frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, id="normal")
self.addPageTemplates(
[
PageTemplate(id="First", frames=frameT, onPage=onFirstPage, pagesize=self.pagesize),
PageTemplate(id="Later", frames=frameT, onPage=onLaterPages, pagesize=self.pagesize),
]
)
if onFirstPage is _doNothing and hasattr(self, "onFirstPage"):
self.pageTemplates[0].beforeDrawPage = self.onFirstPage
if onLaterPages is _doNothing and hasattr(self, "onLaterPages"):
self.pageTemplates[1].beforeDrawPage = self.onLaterPages
BaseDocTemplate.build(self, flowables, canvasmaker=canvasmaker)
开发者ID:skidzo,项目名称:mubosym,代码行数:26,代码来源:autoreport.py
示例6: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
frame2 = Frame(2.5*cm, 2.5*cm, 310, 25*cm, id='F2')
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate('normal', [frame1], myMainPageFrame)
template1 = PageTemplate('special', [frame2], myMainPageFrame)
self.addPageTemplates([template,template1])
开发者ID:Jbaumotte,项目名称:web2py,代码行数:8,代码来源:test_platypus_paragraphs.py
示例7: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1')
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate('nomal', [frame1], onPageEnd=HeaderFooter)
#template = PageTemplate('nomal', [Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1')], onPageEnd=HeaderFooter)
#template = PageTemplate('nomal', [Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1', showBoundary=1)], onPageEnd=HeaderFooter)
self.addPageTemplates(template)
开发者ID:leogao,项目名称:examples,代码行数:8,代码来源:generate_readme_pdf.py
示例8: export
def export(listino, luogoDiRiferimento):
response = http.HttpResponse(content_type='application/pdf')
width, height = portrait(A4)
pageTemplates = [
PageTemplate(id='Listino', onPage=onPageListino),
]
doc = BaseDocTemplate(
response,
pagesize=(width, height),
leftMargin=1 * cm,
rightMargin=1 * cm,
bottomMargin=1.5 * cm,
topMargin=1 * cm,
showBoundary=test,
pageTemplates=pageTemplates,
)
doc.listino = listino # arricchisco il doc
righe_prezzo = listino.prezzolistino_set.all()
story = []
listinoEsclusivo = getTabellaListino(doc, righe_prezzo, 'T', luogoDiRiferimento)
if listinoEsclusivo:
title = Paragraph("SERVIZIO TAXI ESCLUSIVO", normalStyle)
story.append(title)
story.append(listinoEsclusivo)
listinoCollettivo = getTabellaListino(doc, righe_prezzo, 'C', luogoDiRiferimento)
if listinoEsclusivo and listinoCollettivo:
story.append(Spacer(1, 1.5 * cm))
if listinoCollettivo:
title = Paragraph("SEVIZIO COLLETIVO MINIBUS", normalStyle)
story.append(KeepTogether([title, listinoCollettivo]))
if not listinoCollettivo and not listinoEsclusivo:
story.append(
Paragraph("Non abbiamo nessuna corsa specificata nel listino.", normal_style)
)
# footer
footer_style = ParagraphStyle(name='Justify', alignment=TA_JUSTIFY, fontSize=8)
# footer_height = 0
if LISTINO_FOOTER:
note_finali_lines = [LISTINO_FOOTER]
story.append(Spacer(1, 1 * cm))
note_finali = Paragraph("<br/>".join(note_finali_lines),
footer_style)
# note_finali.wrap(width - doc.rightMargin - doc.leftMargin, 5 * cm)
# note_finali.drawOn(canvas, doc.leftMargin, doc.bottomMargin)
# footer_height = note_finali.height
story.append(note_finali)
doc.build(story, canvasmaker=NumberedCanvas)
return response
开发者ID:dariosky,项目名称:tam,代码行数:58,代码来源:pdfListino.py
示例9: __init__
def __init__(self, filename, **kw):
BaseDocTemplate.__init__(self, filename, **kw)
self.addPageTemplates(
[
PageTemplate(id="plain", frames=[Frame(2.5 * cm, 2.5 * cm, 16 * cm, 25 * cm, id="F1")]),
LeftPageTemplate(),
RightPageTemplate(),
]
)
开发者ID:pediapress,项目名称:mwlib.ext,代码行数:9,代码来源:test_platypus_leftright.py
示例10: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5*cm, 15.5*cm, 6*cm, 10*cm, id='F1')
frame2 = Frame(11.5*cm, 15.5*cm, 6*cm, 10*cm, id='F2')
frame3 = Frame(2.5*cm, 2.5*cm, 6*cm, 10*cm, id='F3')
frame4 = Frame(11.5*cm, 2.5*cm, 6*cm, 10*cm, id='F4')
self.allowSplitting = 0
self.showBoundary = 1
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate('normal', [frame1, frame2, frame3, frame4], myMainPageFrame)
self.addPageTemplates(template)
开发者ID:FatihZor,项目名称:infernal-twin,代码行数:10,代码来源:test_platypus_breaking.py
示例11: __init__
def __init__(self, filename, pagesize, stickysize, show_boundary=False):
self.cols = int(pagesize[0] // stickysize[0])
self.rows = int(pagesize[1] // stickysize[1])
templates = [
StickyPage('sticky-page', pagesize, stickysize, self.cols,
self.rows, show_boundary),
]
BaseDocTemplate.__init__(self, filename, pageTemplates=templates,
allowSplitting=0, creator=self._get_creator())
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:10,代码来源:pdf.py
示例12: __init__
def __init__(self, output, status_callback=None, tocCallback=None, **kwargs):
self.bookmarks = []
BaseDocTemplate.__init__(self, output, **kwargs)
if status_callback:
self.estimatedDuration = 0
self.progress = 0
self.setProgressCallBack(self.progressCB)
self.status_callback = status_callback
self.tocCallback = tocCallback
self.title = kwargs["title"]
开发者ID:tosher,项目名称:mwlib.rl,代码行数:10,代码来源:pagetemplates.py
示例13: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id="F1")
frame2 = Frame(11.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id="F2")
frame3 = Frame(2.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id="F3")
frame4 = Frame(11.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id="F4")
self.allowSplitting = 0
self.showBoundary = 1
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplate("normal", [frame1, frame2, frame3, frame4], myMainPageFrame)
self.addPageTemplates(template)
开发者ID:jameshickey,项目名称:ReportLab,代码行数:10,代码来源:test_platypus_breaking.py
示例14: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id="F1")
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template1 = PageTemplate("normal", [frame1], myMainPageFrame)
frame2 = Frame(2.5 * cm, 16 * cm, 15 * cm, 10 * cm, id="F2", showBoundary=1)
frame3 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 10 * cm, id="F3", showBoundary=1)
template2 = PageTemplate("updown", [frame2, frame3])
self.addPageTemplates([template1, template2])
开发者ID:sengupta,项目名称:scilab_cloud,代码行数:11,代码来源:test_platypus_indents.py
示例15: multiBuild
def multiBuild(self,flowables,onFirstPage=_doNothing, onLaterPages=_doNothing):
self._calc() #in case we changed margins sizes etc
frameFirst = Frame(2*cm, 2*cm, 17*cm, 23*cm, id='F1')
frameLater = Frame(2.5*cm, 2*cm, 16*cm, 24.5*cm, id='F2')
self.addPageTemplates([
PageTemplate (id='First',frames=frameFirst, onPage=onFirstPage, pagesize=self.pagesize),
PageTemplate(id='Later',frames=frameLater, onPage=onLaterPages, pagesize=self.pagesize)
])
BaseDocTemplate.multiBuild(self,flowables)
开发者ID:PicciMario,项目名称:SimBrush,代码行数:11,代码来源:report.py
示例16: _showDoc
def _showDoc(fn,story):
pageTemplate = PageTemplate('normal', [Frame(72, 440, 170, 284, id='F1'),
Frame(326, 440, 170, 284, id='F2'),
Frame(72, 72, 170, 284, id='F3'),
Frame(326, 72, 170, 284, id='F4'),
], myMainPageFrame)
doc = BaseDocTemplate(outputfile(fn),
pageTemplates = pageTemplate,
showBoundary = 1,
)
doc.multiBuild(story)
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:11,代码来源:test_platypus_pleaseturnover.py
示例17: __init__
def __init__(self, filename, **kw):
frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template1 = PageTemplate('normal', [frame1], myMainPageFrame)
frame2 = Frame(2.5*cm, 16*cm, 15*cm, 10*cm, id='F2', showBoundary=1)
frame3 = Frame(2.5*cm, 2.5*cm, 15*cm, 10*cm, id='F3', showBoundary=1)
template2 = PageTemplate('updown', [frame2, frame3])
self.addPageTemplates([template1, template2])
开发者ID:jbacou,项目名称:myReportLab_installPackage,代码行数:11,代码来源:test_platypus_indents.py
示例18: __init__
def __init__(self, *args, **kwargs):
BaseDocTemplate.__init__(self, *args, **kwargs)
self.bottomTableHeight = 0
self.bottomTableIsLast = False
self.numPages = 0
self._lastNumPages = 0
self.setProgressCallBack(self._onProgress_cb)
# For batch reports with several PDFs concatenated
self.restartDoc = False
self.restartDocIndex = 0
self.restartDocPageNumbers = []
开发者ID:skidzo,项目名称:mubosym,代码行数:12,代码来源:autoreport.py
示例19: build
def build(self, flowables, firstPageTemplate=_doNothing, laterPageTemplate=_doNothing):
"""Custom build method to separate first page and later page templates.
"""
self._calc() # in case we changed margin sizes
if firstPageTemplate is _doNothing and hasattr(self, 'firstPageTemplate'):
self.pageTemplates[0].beforeDrawPage = self.firstPageTemplate
if laterPageTemplate is _doNothing and hasattr(self, 'laterPageTemplate'):
self.pageTemplates[1].beforeDrawPage = self.laterPageTemplate
BaseDocTemplate.build(self, flowables)
开发者ID:CreativeCreationsLLC,项目名称:Python,代码行数:12,代码来源:writer.py
示例20: _showDoc
def _showDoc(fn, story):
pageTemplate = PageTemplate(
"normal",
[
Frame(72, 440, 170, 284, id="F1"),
Frame(326, 440, 170, 284, id="F2"),
Frame(72, 72, 170, 284, id="F3"),
Frame(326, 72, 170, 284, id="F4"),
],
myMainPageFrame,
)
doc = BaseDocTemplate(outputfile(fn), pageTemplates=pageTemplate, showBoundary=1)
doc.multiBuild(story)
开发者ID:eduardocereto,项目名称:reportlab,代码行数:13,代码来源:test_platypus_pleaseturnover.py
注:本文中的reportlab.platypus.doctemplate.BaseDocTemplate类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论