pdf.page_functions

Functions

empty_page_fn(→ None)

An empty header/footer.

page_fn_footer(→ None)

A standard footer including the page numbers on the right and

page_fn_header(→ None)

A standard header consisting of a title and the creation string. The

page_fn_header_logo(→ None)

A standard header consisting of a SVG logo.

page_fn_header_and_footer(→ None)

A standard header and footer.

page_fn_header_logo_and_footer(→ None)

A standard header logo and footer.

Module Contents

pdf.page_functions.empty_page_fn(canvas: reportlab.pdfgen.canvas.Canvas, doc: onegov.pdf.templates.Template) None[source]

An empty header/footer.

A standard footer including the page numbers on the right and optionally a copyright with the author on the left.

Example:

pdf = Pdf(file, author='OneGov')
pdf.init_a4_portrait(page_fn=page_fn_footer)
pdf.page_functions.page_fn_header(canvas: reportlab.pdfgen.canvas.Canvas, doc: onegov.pdf.templates.Template) None[source]

A standard header consisting of a title and the creation string. The title is automatically wrapped and shortened.

Example:

pdf = Pdf(file, author='OneGov', created='1.1.2000')
pdf.init_a4_portrait(page_fn=page_fn_header)

A standard header consisting of a SVG logo.

The logo is drawn in its original size placed at the bottom on the header, which allows to give extra margin at the bottom directly in the SVG.

Example:

pdf = Pdf(
    file, author='OneGov', created='1.1.2000',
    logo='<?xml version="1.0"><svg>...</svg>'
)
pdf.init_a4_portrait(page_fn=page_fn_header_logo)

A standard header and footer.

Example:

pdf = Pdf(file, title='Title', created='1.1.2000', author='OneGov')
pdf.init_a4_portrait(
    page_fn=page_fn_footer,
    page_fn_later=page_fn_header_and_footer
)

A standard header logo and footer.

Example:

pdf = Pdf(
    file, title='Title', created='1.1.2000', author='OneGov',
    logo='<?xml version="1.0"><svg>...</svg>'
)
pdf.init_a4_portrait(
    page_fn=page_fn_header_logo_and_footer,
    page_fn_later=page_fn_header_and_footer
)