本文整理汇总了Python中reportlab.platypus.PageBreak方法的典型用法代码示例。如果您正苦于以下问题:Python platypus.PageBreak方法的具体用法?Python platypus.PageBreak怎么用?Python platypus.PageBreak使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus
的用法示例。
在下文中一共展示了platypus.PageBreak方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_cover_page
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def get_cover_page(self, report_id, recipient):
# title = f"{self.report_title} No.: {report_id}"
styles = getSampleStyleSheet()
headline_style = styles["Heading1"]
headline_style.alignment = TA_CENTER
headline_style.fontSize = 48
subtitle_style = styles["Heading2"]
subtitle_style.fontSize = 24
subtitle_style.leading = 26
subtitle_style.alignment = TA_CENTER
CoverPage = []
logo = os.path.join(settings.BASE_DIR, self.logo_path)
image = Image(logo, 3 * inch, 3 * inch)
CoverPage.append(image)
CoverPage.append(Spacer(1, 18))
CoverPage.append(Paragraph("CONFIDENTIAL", headline_style))
# paragraph = Paragraph(
# f"Intended for: {recipient}, Title IX Coordinator", subtitle_style)
# CoverPage.append(paragraph)
CoverPage.append(PageBreak())
return CoverPage
# entrypoints
示例2: add_summary
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def add_summary(self, summary_table=[]):
self.story.append(Spacer(1, 8*cm))
self.story.append(Paragraph("Sequencing Report", self.title_style))
style = self.normal_style
style.alignment = TA_CENTER
self.story.append(Paragraph("{}".format(self.tag), style))
self.story.append(Spacer(1, 4*cm))
summary_table_style = [('ALIGN',(0,0),(0,-1),'RIGHT'),
('ALIGN',(1,0),(1,-1),'LEFT')]
if len(summary_table):
self.story.append(Table(summary_table, style=summary_table_style))
self.story.append(Spacer(1, 1*cm))
self.story.append(Paragraph("Nanopype {}".format(self.version), style))
self.story.append(PageBreak())
示例3: report_pages
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def report_pages(self, reports: list):
pages = []
for report in reports:
pages.extend(self.report_page(report))
pages.append(PageBreak())
return pages
示例4: match_pages
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def match_pages(self, match_report_and_report_content: list):
pages = []
for (match_report, match_content) in match_report_and_report_content:
pages.extend(self.match_page(match_report, match_content))
pages.append(PageBreak())
return pages
示例5: cover_page
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def cover_page(self):
return [
Image(
os.path.join(settings.BASE_DIR, api.NotificationApi.logo_path),
3 * inch,
3 * inch,
),
Spacer(1, 18),
Paragraph("CONFIDENTIAL", self.headline_style),
Spacer(1, 30),
Spacer(1, 40),
Paragraph(self.title, self.subtitle_style),
Spacer(1, 40),
PageBreak(),
]
示例6: pdf_write
# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import PageBreak [as 别名]
def pdf_write(generated_pdf_path):
"""
生成pdf
:return:
"""
# 增加的字体,支持中文显示,需要自行下载支持中文的字体
font_path = current_app.config.get("SIM_SUN")
pdfmetrics.registerFont(TTFont('SimSun', os.path.join(font_path, 'SimSun.ttf')))
styles = getSampleStyleSheet()
styles.add(ParagraphStyle(fontName='SimSun', name='SimSun', leading=20, fontSize=12))
data = list()
# 添加一段文字
paragraph = paragraph_model("测试添加一段文字")
data.append(paragraph)
data.append(PageBreak()) # 分页标识
# 添加table和图片
table = table_model()
data.append(table)
data.append(PageBreak()) # 分页标识
img = image_model()
data.append(img)
# 设置生成pdf的名字和编剧
pdf = SimpleDocTemplate(generated_pdf_path, rightMargin=0, leftMargin=0, topMargin=40, bottomMargin=0, )
# 设置pdf每页的大小
pdf.pagesize = (9 * inch, 10 * inch)
pdf.multiBuild(data)
return generated_pdf_path