Skip to content

Report

Base functionality for PDF data reports

PDF

Bases: FPDF

PDF document customized for data reports

Extends the methods of fpdf.FPDF with common report methods and default settings.

Parameters:

Name Type Description Default
logo str

Path to a logo image to include in the page header.

None

line_height property

Calculated text line height

footer()

Create footer section on current page

header()

Create header section on current page

horizontal_rule(y)

Create a horizontal divider line

insert_mpl_plot()

Insert the current Matplotlib plot

make_title(title, super_title=None)

Create the report title

Parameters:

Name Type Description Default
title str

The report title text.

required
super_title str

A smaller title above the main title, intended to state the report type.

None

section(text, add_page=True)

Create a section header

set_text_font()

Set default font size

subsection(text, add_page=False)

Create a sub-section header

Report

Abstract base class for data reports

Parameters:

Name Type Description Default
author str

Report author.

None

body()

Create report contents

make()

Build the entire report

plot_context()

Context manager to insert a Matplotlib figure

row(*cell_texts)

Create a table row

save(path)

Create report and save to file

Parameters:

Name Type Description Default
path str | Path

Output path.

required

section(heading)

Create a new section

subsection(heading)

Create a new sub-section

table(widths=None, aligns=None)

Context manager to create a table

Parameters:

Name Type Description Default
widths list[float]

Column widths.

None
aligns list[str]

Column alignments.

None

text(text)

Write a simple line of text

title(title, super_title=None)

Create the title

plot(func)

Decorator marking report class methods as plots