当前位置: 首页>>代码示例>>Python>>正文


Python platypus.PageBreak方法代码示例

本文整理汇总了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 
开发者ID:project-callisto,项目名称:callisto-core,代码行数:28,代码来源:api.py

示例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()) 
开发者ID:giesselmann,项目名称:nanopype,代码行数:16,代码来源:report.py

示例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 
开发者ID:project-callisto,项目名称:callisto-core,代码行数:8,代码来源:report_delivery.py

示例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 
开发者ID:project-callisto,项目名称:callisto-core,代码行数:8,代码来源:report_delivery.py

示例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(),
        ] 
开发者ID:project-callisto,项目名称:callisto-core,代码行数:17,代码来源:report_delivery.py

示例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 
开发者ID:qzq1111,项目名称:flask-restful-example,代码行数:32,代码来源:report.py


注:本文中的reportlab.platypus.PageBreak方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。